I am craeting a windows application with vb.net 2005. I am using Panel with 'Dock' Property is 'Left'. My panel includes Buttons also.In the application in MouseEnter event of the Panel will set the Panel.Width=200. And in MouseLeave Event,Panel.Width=10. But the problem is While MouseEnter on the buttons inside the panel,the Panel_MouseLeave Event is triggering and Panel Width is set to 10. How to rectify this problem
Please help me.
Best regards,
Fuad
FroglegPosted Aug 7, 2012, 6:22 AM
Public Class Form1
Dim pt As Point
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Panel1.Width = 10
End Sub
Private Sub Panel1_MouseEnter(sender As System.Object, e As System.EventArgs) Handles Panel1.MouseEnter
Panel1.Width = 200
End Sub
Private Sub Panel1_MouseLeave(sender As System.Object, e As System.EventArgs) Handles Panel1.MouseLeave
If pt.X > Panel1.Width - 10 Then
Panel1.Width = 10
End If
If pt.Y < 10 Then
Panel1.Width = 10
ElseIf pt.Y > (Panel1.Height - 10) Then
Panel1.Width = 10
End If
End Sub
Private Sub Panel1_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
pt = e.Location
End Sub
End Class
FroglegPosted Aug 13, 2012, 5:17 PM
I did not provide code for that situation
Another way is
Private Sub Form1_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Panel1.Width = 10
End Sub
fuad pulpadanPosted Aug 8, 2012, 12:15 AM