111,126
社区成员
发帖
与我相关
我的任务
分享
private const int SC_MOVE = 0xF012;
private const int WM_SysCommand = 0x0112;
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(int hWnd, int wMsg, int wParam, int lParam);
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
private static extern int ReleaseCapture();
if (WindowState == FormWindowState.Normal)
{
ReleaseCapture();
SendMessage(this.Handle.ToInt32(), WM_SysCommand, SC_MOVE, 0);
}