I have a userControl (.NET 1.1 Winforms) that has a clickable picturebox as a button.
Since I have lots of those usercontrols visible at the same time, I thought It could be nice if I just display the picture box when the mouse is over the usercontrol and hide it otherwise.
To do so, I handle the MouseEnter and MouseLeave events of the UserControl, hiding and displaying the picturebox. That works fine.
But when the clickable picturebox is visible I'm not longer able to click it (the hand cursor is gone and the click event is not firing).
After some test, I realize that if comment all content on the MouseLeave handler that do something with my picturebox... this way the picturebox is clickable.
I'm not using the correct event?
There's another way to accomplish this?
Here is the code...
Private Sub NodoEstablo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.pictAdd.Visible = False
End Sub
Private Sub NodoEstablo_MouseEnters(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter
Me.pictAdd.Visible = True
End Sub
The problematic event handler:
Private Sub NodoEstablo_MouseLeaves(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MouseLeave
Me.pictAdd.Visible = False
End Sub
Update: If I resize the picturebox on MouseLeave (just to do something) it works. So far, changing Visible and Location in the MouseLeave prevent me for click the picturebox. :S