Can you explain a little more what you are trying to do Are you trying to do something like change the image in a picturebox when the mouse is over the control If so, I would use the MouseEnter and MouseLeave events... They should do precisely what you need.
Translate to TabControl & TabPage -- how do you sense & respond to a MouseEnter on a TabPage (or TabControl) and detect which "tab" the mouse is over (equivalent of mouseover on html object)
The MouseEnter event fires when the movement of the mouse enters the bounds of the control. The MouseLeave fires when the mouse leaves the bounds of the control. So, you could add some code like this:
Private Image1 As Image = Image.FromFile("C:\Pictures\work.gif") Private Image2 As Image = Image.FromFile("C:\Pictures\work2.gif") Private Sub PictureBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter PictureBox1.Image = Image1 End Sub
Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave PictureBox1.Image = Image2 End Sub
mouseover
Fredrik Bergström
could you explain a little more on that please thanks a lot :)
Josh Zana
NACSUS
Adam Cirillo
Is it possible to get the two images (image1 and Image2) at design time
ie, setting 2 properties which will give the 2 respective images
Stahl
Private Image1 As Image = Image.FromFile("C:\Pictures\work.gif")
Private Image2 As Image = Image.FromFile("C:\Pictures\work2.gif")
Private Sub PictureBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
PictureBox1.Image = Image1
End Sub
Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave
PictureBox1.Image = Image2
End Sub