
How to move a WinForm without top-bar control.
Some times can happen to move a Window without border, for example for a window of credits like SkyWhi:
Once again is necessary to use InteropServices to emulate Window Manager control in an other point of window:
using System.Runtime.InteropServices;
...
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
//Include external method to pilot a window.
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
//Include external method to capturing a window.
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
//Window MouseDown event handler.
private void Application_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
   {
    ReleaseCapture();
    SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
   }
}
--
Enjoy your windows! :)
Posted Sunday 18 June 2006 - 20:37
Other news about this topic
[C# .NET] Moving WinForm without top-bar. (18/06/2006 - 20:37) read 112 times
[C# .NET] Develop C# Applications under Linux. (17/06/2006 - 16:43) read 79 times
[C# .NET] Play sounds like embedded resources. (17/06/2006 - 16:24) read 108 times
[C# .NET] Set Proxy in IE Component. (16/06/2006 - 01:55) read 99 times
[C# .NET] System.Media VS. PlaySound. (15/06/2006 - 18:36) read 112 times