在form左边dock一个panel 当鼠标移到form左边时,panel自动从左边出来,离开后自动隐藏
Private
Sub Timer1_Tick()
Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim currpos As System.Drawing.Point
currpos = Me.Cursor.Position
Dim x As Integer
'x = currpos.X - Me.Panel1.Left
x = currpos.X - Me.Left
If Math.Abs(x) < Me.Panel1.Left + 20 Then
If Me.Panel1.Width < 220 Then
Me.Panel1.Width += 20
End If
Else
If Me.Panel1.Width > 15 Then
Me.Panel1.Width -= 20
End If
End If
End Sub
Dim currpos As System.Drawing.Point
currpos = Me.Cursor.Position
Dim x As Integer
'x = currpos.X - Me.Panel1.Left
x = currpos.X - Me.Left
If Math.Abs(x) < Me.Panel1.Left + 20 Then
If Me.Panel1.Width < 220 Then
Me.Panel1.Width += 20
End If
Else
If Me.Panel1.Width > 15 Then
Me.Panel1.Width -= 20
End If
End If
End Sub