Change borderstyle on mouse hover

  • Thread starter Thread starter Saber
  • Start date Start date
S

Saber

glb is a global string, I want when moving mouse to a picturebox, change
border style of picturebox.
the code shown below do that but MouseLeave event fires less than a second
after MouseHover,
even without leaving the mouse pointer or moving that.
I also tried MouseEnter event instead of MouseHover, but they act same here.


Private Sub p1_MouseHover(ByVal sender As Object, ByVal e As
System.EventArgs) Handles p1.MouseLeave, p2.MouseEnter, p3.MouseEnter,
p4.MouseEnter, p5.MouseEnter, p6.MouseEnter, p7.MouseEnter, p8.MouseEnter,
p9.MouseEnter, p10.MouseEnter, p11.MouseEnter, p12.MouseEnter

sender.BorderStyle = BorderStyle.FixedSingle
glb = sender.Name

End Sub


Private Sub p1_MouseLeave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles p1.MouseLeave, p2.MouseEnter, p3.MouseEnter,
p4.MouseEnter, p5.MouseEnter, p6.MouseEnter, p7.MouseEnter, p8.MouseEnter,
p9.MouseEnter, p10.MouseEnter, p11.MouseEnter, p12.MouseEnter

If glb = sender.Name Then sender.BorderStyle = BorderStyle.None

End Sub
 
In your code below, p1_MouseHover and p1_MouseLeave both handles the
exact same events. Unless this is a typo in your post I'd say this is the
problem

/claes
 
Thanks, I've been sleepy and didn't notice that!

Claes Bergefall said:
In your code below, p1_MouseHover and p1_MouseLeave both handles the
exact same events. Unless this is a typo in your post I'd say this is the
problem

/claes
 
Back
Top