#region 窗体移动
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
private static extern void ReleaseCapture();
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessage")]
private static extern void SendMessage(int hwnd, int wMsg, int wParam, int lParam);
public static void WinControl_MouseDown(this Control c, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (c is Form)
{
Form f = (Form)c;
if (f.WindowState != FormWindowState.Normal)
{
return;
}
}
ReleaseCapture();
SendMessage((int)c.Handle, 0xA1, 2, 0);
}
}
#endregion 窗体移动