Imports SystemDrawing
Imports SystemWindowsForms
******************************************
Private oOriginalRegion As Region = Nothing
用于窗体移动
Private bFormDragging As Boolean = False
Private oPointClicked As Point
******************************************
Private Sub Form_MouseDown(ByVal sender As Object ByVal e As SystemWindowsFormsMouseEventArgs) Handles MyBaseMouseDown
MebFormDragging = True
MeoPointClicked = New Point(eX eY)
End Sub
******************************************
Private Sub Form_MouseUp(ByVal sender As Object ByVal e As SystemWindowsFormsMouseEventArgs) Handles MyBaseMouseUp
MebFormDragging = False
End Sub
******************************************
Private Sub Form_MouseMove(ByVal sender As Object ByVal e As SystemWindowsFormsMouseEventArgs) Handles MyBaseMouseMove
If MebFormDragging Then
Dim oMoveToPoint As Point
以当前鼠标位置为基础找出目标位置
oMoveToPoint = MePointToScreen(New Point(eX eY))
根据开始位置作出调整
oMoveToPointOffset(MeoPointClickedX * _
(MeoPointClickedY + _
SystemInformationCaptionHeight + _
SystemInformationBorderSizeHeight) * )
移动窗体
MeLocation = oMoveToPoint
End If