Option Explicit
Private isMouseDown As Boolean
Private mouseX As Integer
Private mouseY As Integer
Private currX As Integer
Private currY As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
isMouseDown = True
mouseX = X
mouseY = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If isMouseDown Then
currX = Me.Left - mouseX + X
currY = Me.Top - mouseY + Y
Me.Move currX, currY
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
isMouseDown = False
End Sub
楼主这方法比用API好...因为体现的编程的技巧!顶!
/images/2011/147787/2011051411021524.jpg" border="0" />