C# Moveable Window

  • Thread starter Thread starter pocketbin
  • Start date Start date
P

pocketbin

Hello,

I have a C# App with no toolbar and no border. How can I make it
possible for the user to move the app if there is no title bar?

Thanks
 
Here is one way to do it add this to your form. It basically tells windows
that your whole form acts like a titlebar.

// Let Windows drag this form for us
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0084 /*WM_NCHITTEST*/) {
m.Result= (IntPtr)2; // HTCLIENT
return;
}
base.WndProc(ref m);
}
 
Thanks for the code, but it still does not move the app. Any ideas why
this code is not working?
 
Back
Top