c# - Make a borderless form movable? -


Is there a way to create a form that has no limit (formbord style is set to "none") when Was the mouse clicked down on the form just as if there was a limit? Thank you.

The article on CodeProject gives the details of a technique. Basically boils down to:

  public const int WM_NCLBUTTONDOWN = 0xA1; Public const int HT_CAPTION = 0x2; [System.Runtime.InteropServices.DllImportAttribute ("user32.dll")] Public static extern int SendMessage (IntPtr hWnd, int message, int wParam, int lParam); [System.Runtime.InteropServices.DllImportAttribute ("user32.dll")] Public static extern bool ReleaseCapture (); Private Zero form 1_MouseDown (Object Sender, System.Windows.Forms.MouseEventArgs e) {if (e.button == MouseButtons.Left) {ReleaseCapture (); SendMessage (handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); }}  

This essentially does the same thing as grabbing the title bar of a window from exactly the window viewer's point view.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -