Mousehover et DataGridView
Bonjour, bonjour,
je souhaite lorsque ma souris passe au dessus d'une colonne de mon DatagGridView (DGV_echantillon) que cette colonne soit HighLighted (surligné).
Donc pour cela j'utilise l'évènement MouseHover de DGV_Echeantillon !
J'ai trouvé ça sur Social.MSDN:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
Dim pt As New Point
Dim hti As DataGridView.HitTestInfo
Try
pt = Me.PointToClient(MousePosition)
Catch ex As Exception
End Try
hti = Me.DGV_echantillon.HitTest(pt.X, pt.Y)
If hti.Type = DataGridViewHitTestType.Cell Then
Me.DGV_echantillon.Columns(hti.ColumnIndex).Selected = True
End If |
Le code me semblait bien, l'évènement se déclenche bien mais Problèmes:
- hti.Type retourne 0 au lieu de 1 (rien donc) !
- hti.ColumnIndex retourne -1
Merci d'avance pour le partage de vos expériences !