1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub Form_Load()
Dim T As Integer
MSHFlexGrid1.Cols = 1
MSHFlexGrid1.FixedCols = 0
MSHFlexGrid1.FixedRows = 0
MSHFlexGrid1.Rows = 10
MSHFlexGrid1.Col = 0
For T = 0 To MSHFlexGrid1.Rows - 1
MSHFlexGrid1.Row = T
MSHFlexGrid1.TextMatrix(T, 0) = "ligne N° " & T + 1
Next T
End Sub
Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Shift = vbCtrlMask And Button = vbKeyLButton Then 'Ctrl + Bt. gauche
If MSHFlexGrid1.CellBackColor = &H80000005 Then
MSHFlexGrid1.CellBackColor = &HC0FFC0 'couleur pour ligne sélectionnée
Else
MSHFlexGrid1.CellBackColor = &H80000005 'couleur pour ligne non sélectionnée
End If
End If
End Sub |
Partager