This question has already been answered:
- Movable form with hidden borders 1 answer
How to make so that the movement of the form was carried out not only for the upper limit, but for any part of this form?
This question has already been answered:
How to make so that the movement of the form was carried out not only for the upper limit, but for any part of this form?
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
It is possible through the event handler, when you hold the mouse on the form and move the mouse, change the property of the form position, that is, add the mouse offset coordinates to the form coordinates, this is if the WinAPI option does not work for you
Thank you all. Following the link Ruslana Artamonov chose this varinat. Everything works out beautifully:
public const int WM_NCLBUTTONDOWN = 0xA1; public const int HTCAPTION = 0x2; [DllImport("User32.dll")] public static extern bool ReleaseCapture(); [DllImport("User32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); void Form_Load(object sender, EventArgs e) { this.MouseDown += new MouseEventHandler(Form_MouseDown); } void Form_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); } } Leaving out some details, the form began to look like this. From any place of the form, except for controls, you can drag on the screen. 
Source: https://ru.stackoverflow.com/questions/608424/
All Articles