I was looking through some old C# projects on my external hard drive, when I stumbled upon the following code snippet, which makes a borderless form draggable.
protected override void WndProc(ref Message m)
if (m.Msg == 163 && this.ClientRectangle.Contains(this.PointToClient(new Point(m.LParam.ToInt32()))) && m.WParam.ToInt32() == 2)
m.WParam = (IntPtr)1;
if (m.Msg == 132 && m.Result.ToInt32() == 1)
m.Result = (IntPtr)2;
This makes the form draggable by clicking and dragging anywhere on the form itself (that is, not on controls unless they are disabled).