17,741
社区成员
发帖
与我相关
我的任务
分享
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
private void frmMain_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x0112, 0xF012, 0);
}
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
if ((int)m.Result == HTCAPTION)
m.Result = (IntPtr)HTCLIENT;
return;
break;
}
base.WndProc(ref m);
}