ToolTipText dans un datagrid en VB.Net

seemax Messages postés 20 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 27 avril 2004 - 20 avril 2004 à 11:24
seemax Messages postés 20 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 27 avril 2004 - 22 avril 2004 à 14:15
Bonjour,
je souhaite changer mon tooltiptext a chaque fois que je change de cellule dans mon datagrid (afficher le contenu de la cellule survolée avec la souris).
Est ce que quelqu'un aurait deja fait ce genre de chose (j'insiste en VB.Net!)
Merci

2 réponses

seemax Messages postés 20 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 27 avril 2004
20 avril 2004 à 17:35
J'ai avancé sur mon problème avec la solution suivante :

Private Sub DataGridConsignesEngins_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridConsignesEngins.MouseMove
        Dim TexteTooltip As String
        Dim hti As DataGrid.HitTestInfo

        hti = DataGridConsignesEngins.HitTest(e.X, e.Y)
        If hti.Type = DataGrid.HitTestType.Cell Then
            ' Initialisation du ToolTip

            monToolTip.AutoPopDelay = 5000
            monToolTip.InitialDelay = 100
            monToolTip.ReshowDelay = 1000

            If monToolTip.Active = True Then
                monToolTip.Active = False
            End If
            TexteTooltip = "Informations complémentaires " & hti.Row & " " & hti.Column
            monToolTip.SetToolTip(Me.DataGridConsignesEngins, TexteTooltip)
            monToolTip.Active = True
        End If
    End Sub


Cependant, ce code marche sur les entetes des lignes et des colonnes de ma datagrid (mon tooltip aparait correctement avec les infos que je desire a l'interieur), mais des que je passe la souris dans une cellule normale (par exemple la cellule 3 de la colonne 2), plus rien ne marche (pourtant avec un point d'arret je constate que ma procédure est executée avec les bons paramètres comme pour les entetes de colonne)

Est ce que quelqu'un aurait une idée s'il vous plait...
0
seemax Messages postés 20 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 27 avril 2004
22 avril 2004 à 14:15
Voila pour ceux que sa interesse voila comment faire :

Private Sub DataGridConsignesEngins_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridConsignesEngins.MouseMove 
        Dim TexteTooltip As String 
        Dim hti As DataGrid.HitTestInfo 

        hti = DataGridConsignesEngins.HitTest(e.X, e.Y) 
        If hti.Type = DataGrid.HitTestType.Cell And HitRow <> hti.Row Then 
            ' Initialisation du ToolTip 
            HitRow = hti.Row 'declarée au niveau de la classe 
            monToolTip.AutoPopDelay = 5000 
            monToolTip.InitialDelay = 500 
            monToolTip.ReshowDelay = 1000 

            If monToolTip.Active = True Then 
                monToolTip.Active = False 
            End If 
            TexteTooltip = "Informations complémentaires " & hti.Row & " " & hti.Column 
            monToolTip.SetToolTip(Me.DataGridConsignesEngins, TexteTooltip) 
            monToolTip.Active = True 
        End If 
    End Sub 

0
Rejoignez-nous