📜  vb.net 无标题栏拖动窗口 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:18.561000             🧑  作者: Mango

代码示例1
Public Const WM_NCLBUTTONDOWN As Integer = &HA1 
Public Const HT_CAPTION As Integer = &H2 

 _ 
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function

 _ 
Public Shared Function ReleaseCapture() As Boolean
End Function

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown, Panel1.MouseDown 
    If e.Button = Windows.Forms.MouseButtons.Left Then
        ReleaseCapture() 
        SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0) 
    End If
End Sub