vb.net实现无标题栏窗体可拖动
'Win32 API
Declare Auto Function ReleaseCapture Lib "user32.dll" Alias "ReleaseCapture" () As Boolean
Declare Auto Function SendMessage Lib "user32.dll" Alias "SendMessage" (ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
'Win32 Message
Private Const WM_SYSCOMMAND As Integer = &H112&
Private Const SC_MOVE As Integer = &HF010&
Private Const HTCAPTION As Integer = &H2&
Private Sub frmLogin_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If e.Button = MouseButtons.Left Then
ReleaseCapture()
SendMessage(Me.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
End If
End Sub
DinoBox_地下室侧壁计算小程序
欢迎关注微信公众账号ByCAD