Hi,
You'll need to use several API's to achieve this:
//API functions to move the form public const int WM_NCLBUTTONDOWN = 0xA1; public const int HTCAPTION = 0x2; [DllImportAttribute("user32.dll")] public static extern bool ReleaseCapture(); [DllImportAttribute("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
And in your mouse down event of the form:
public void Form1_MouseDown(object sender, MouseEventArgs e) { //If the left mouse is pressed, release form for movement if (e.Button == MouseButtons.Left) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); }
cheers,
Paul June A. Domag
|