怎么样用鼠标控制窗体的移动
怎么样用鼠标控制窗体的移动有没有现成的函数可以调用
API 有两个函数。
private const int HTCAPTION = 0x0002;
private const int WM_NCLBUTTONDBLCLK = 0x00A3;
[DllImport("user32.dll", EntryPoint="SendMessageA")]
public static extern int SendMessage(int hWnd, int wMsg, int wParam, int lParam);
[DllImport("user32.dll", EntryPoint="ReleaseCapture")]
public static extern int ReleaseCapture(void);
MOUSEDOWN写入
ReleaseCapture();
SendMessage(this.Handle.ToInt32(), WM_NCLBUTTONDOWN, HTCAPTION, 0);
OK,搞定。