'共享模块
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Dim PrevX As Long, PrevY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
PrevX = X: PrevY = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If Button = 1 Then
Select Case Me.MousePointer
Case 0
'Me.Move Me.Left + X - PrevX, Me.Top + Y - PrevY
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
Case 7
Me.Height = Y
Case 8
Me.Width = X: Me.Height = Y
Case 9
Me.Width = X
End Select
End If
If Y > Me.ScaleHeight - 120 Then
Me.MousePointer = IIf(X > Me.ScaleWidth - 120, 8, 7)
Else
Me.MousePointer = IIf(X > Me.ScaleWidth - 120, 9, 0)
End If
End Sub