可以利用鼠标的位置来确定是否切换显示模式,但要求鼠标的移动速度不能太快,以下是窗体的代码部分,试试看:- Dim i As Boolean
- Private Sub CommandButton1_Click()
- Me.Hide
- End Sub Private Sub UserForm_Initialize()
- i = True
- End Sub
- Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
- 'Debug.Print X & "," & Y
- If (X < 5 Or Y < 5 Or X > Me.Width - 15 Or Y > Me.Height - 25) Then
- If i = True Then
- i = False
- Me.StartUpPosition = 3
- Me.Hide
- Me.Show 0
- End If
- Else
- If i = False Then
- i = True
- Me.StartUpPosition = 3
- Me.Hide
- Me.Show 1
- End If
- End If
- End Sub
|