老有关问题 vb.net 移动没有标题的窗体,高分

老问题 vb.net 移动没有标题的窗体,高分
关于vb.net   移动没有标题的窗体的问题,在网上搜一下,只有vb6.0的方法:
        Declare   Function   ReleaseCapture   Lib   "user32 "   ()   As   Long
        Declare   Function   SendMessage   Lib   "user32 "   Alias   "SendMessageA "   (ByVal   hwnd   As   Long,   ByVal   wMsg   As   Long,   ByVal   wParam   As   Any)   As   Long
        Public   Const   HTCAPTION   =   2
        Public   Const   hwnd   =   2
        Public   Const   WM_NCLBUTTONDOWN   =   &HA1
……
在vb.net里不知道怎么搞了。请高手赐教。

------解决方案--------------------
参考下面代码:
Public Class frmMove
Private HTCAPTION As IntPtr = 2
Private HTCLIENT As IntPtr = 1
Private WM_NCHITTEST As Integer = 132

Protected Overrides Sub WndProc(ByRef m As Message)
If (m.Msg = WM_NCHITTEST) Then
MyBase.WndProc(m)
If (m.Result = HTCLIENT) Then
m.Result = HTCAPTION
End If
ElseIf (m.Msg = 163) Then
Else
MyBase.WndProc(m)
End If
End Sub
End Class
------解决方案--------------------
不用API


#Region "移动窗体 "
Dim bMouseDown As Boolean
Dim pntMousePosition As Point
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
bMouseDown = True
pntMousePosition.X = e.X
pntMousePosition.Y = e.Y
End Sub

Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
bMouseDown = False
End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Static bProcessingEvent As Boolean
If bProcessingEvent Then
Exit Sub
End If
If bMouseDown Then
bProcessingEvent = True
Dim NewX As Integer = Me.Location.X + (e.X) - pntMousePosition.X
Dim NewY As Integer = Me.Location.Y + (e.Y) - pntMousePosition.Y
Me.SetDesktopLocation(NewX, NewY)
bProcessingEvent = False
End If
End Sub
#End Region