views:

26

answers:

3

Can I create a tooltip that will show up when a user moves his/her cursor over an image? I can't find such a property in Visual Studio, and I've scoured Google to no avail. I'm using an image in a PictureBox.

Here's to anyone out there on StackOverflow instead of some awesome Halloween party! Yay!

+1  A: 

yea, for some reason the Picturebox doesnt have one.


imports System.Drawing


dim tt as new ToolTip()
tt.SetToolTip(picPicture, "This is a picture") 

and dont worry, the weekend has only started, plenty of time to party.

jasper
Perfect, thanks!!!
Louise
A: 

Assuming that you have added a picture box member with the WithEvents modifier you can use the following

Private tt As ToolTip = New ToolTip()

Sub OnPictureMouseHover(ByVal sender As Object, ByVal e As EventArgs) Handles PictureBox1.MouseHover
    tt.Show("the message", Me)
End Sub

Sub OnPictureMouseLeave(ByVal sender As Object, ByVal e As EventArgs) Handles PictureBox1.MouseLeave
    tt.Hide()
End Sub
JaredPar
A: 

Typically I create the interface then throw a ToolTip object from the Toolbox on to the form.

alt text

This then gives each object the "ToolTip" property (towards the bottom of the list) which can then be configured to your delight.

alt text

Bryan Allred