I have a form created in Windows Forms which is draggable wherever I click. I made it by overriding WndProc function which in turn modifies each click as it was a title bar
I've done the same as Jex which is working great.
private const int WM_NCHITTEST = 0x84;
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
private const int WM_LBUTTONDBLCLK = 0x00A3;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_LBUTTONDBLCLK)
{
return;
}
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
if ((int)m.Result == HTCLIENT)
m.Result = (IntPtr)HTCAPTION;
return;
}
base.WndProc(ref m);
}