Salut,
je cherche a creer une tooltip avec image
j'ai bien cherche sur le net est j'ai trouve se code la

Code vb.net : Sélectionner tout - Visualiser dans une fenêtre à part
Public pb1 As PictureBox = New PictureBox()
Code vb.net : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        pb1.Load(My.Application.Info.DirectoryPath & "\untitled2.JPG")
        'SET THE VISIBILITY TO FALSE
        pb1.Visible = False
        ToolTip1.SetToolTip(PictureBox10, "blalblabla")
end sub
Code vb.net : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
Private Sub ToolTip1_Popup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PopupEventArgs) Handles ToolTip1.Popup
        Dim wid As Integer = e.ToolTipSize.Width + pb1.Image.Width
        'GET THE WIDTH OF THE TOOLTIP AND KEEP SPACE FOR THE IMAGE
        Dim hgt As Integer = e.ToolTipSize.Height + pb1.Image.Height + 40
        'GET THE HEIGHT OF THE TOOLTIP AND KEEP SPACE FOR THE IMAGE PLUS A BIT
        If hgt < 50 Then hgt = 50
        'SET THE HEIGHT TO 50 IF IT IS TOO NARROW
        e.ToolTipSize = New Size(wid, hgt)
        'SET THE TOOLTIP SIZE
    End Sub
Code vb.net : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 Private Sub ToolTip1_Draw(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawToolTipEventArgs) Handles ToolTip1.Draw
        ' Draw the background and border.
        e.DrawBackground()
        e.DrawBorder()
        ' Draw the text.
        Using sf As New StringFormat()
            sf.Alignment = StringAlignment.Near
            sf.LineAlignment = StringAlignment.Center
            Dim rect As New Rectangle(50, 0, e.Bounds.Width - 50, e.Bounds.Height)
            e.Graphics.DrawString(e.ToolTipText, e.Font, Brushes.Green, rect, sf)
        End Using
        ' Draw the image.
        e.Graphics.DrawImage(pb1.Image, 9, 9)
    End Sub

mais helas l'image ne s'affiche pas ...


voila le site source http://sahilebrahim.blogspot.com/201...ith-image.html