Read [C# .NET] Moving WinForm without top-bar.
Developing.pngHow 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:


uploaded_image


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

Read [C# .NET] Moving WinForm without top-bar. (18/06/2006 - 20:37) read 112 times
Read [C# .NET] Develop C# Applications under Linux. (17/06/2006 - 16:43) read 79 times
Read [C# .NET] Play sounds like embedded resources. (17/06/2006 - 16:24) read 108 times
Read [C# .NET] Set Proxy in IE Component. (16/06/2006 - 01:55) read 99 times
Read [C# .NET] System.Media VS. PlaySound. (15/06/2006 - 18:36) read 112 times
Necrosoft Home

Calendar
Date: 27/11/2009
Time: 15:51



Search





Poll
Tech_Bl0G Quality?






[ Results | Polls ]
Votes: 3 | Comments: 0

Users
People on-line:     
guests 4 guests

Stats
Visits: 2838
Statistics

Admin Login

: