How can I shut down/restart the OS from my Windows Forms Application?
You could do this using the WMI Classes in the .NET Framework or use WindowsController available at http://www.mentalis.org
How can I move a Borderless form?
This code snippet shows how you can move a borderless form. [C#] public const int WM_NCLBUTTONDOWN = 0xA1; public const int HTCAPTION = 0x2; [DllImport(‘User32.dll’)] public static extern bool ReleaseCapture(); [DllImport(‘User32.dll’)] public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { ReleaseCapture(); SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); } }
How can I make my form cover the whole screen including the TaskBar?
The following code snippet demonstrates how you can make your form cover the whole screen including the Windows Taskbar. [C#] // Prevent form from being resized. this.FormBorderStyle = FormBorderStyle.FixedSingle; // Get the screen bounds Rectangle formrect = Screen.GetBounds(this); // Set the form’s location and size this.Location = formrect.Location; this.Size = formrect.Size; [VB.NET] ’ Prevent form from being resized. Me.FormBorderStyle = FormBorderStyle.FixedSingle ’ Get the screen bounds Dim formrect As Rectangle = Screen.GetBounds(Me) ’ Set the form’s location and size Me.Location = formrect.Location Me.Size = formrect.Size
How can I word-wrap the Tooltip that is displayed?
Rhett Gong posted a work around using Reflection to achieve this in the microsoft.public.dotnet.framework.windowsforms.controls Newsgroup: [DllImport(‘user32.dll’)] private extern static int SendMessage(IntPtr hwnd,uint msg, int wParam, int lParam); ….. object o = typeof(ToolTip).InvokeMember(‘Handle’,BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.GetProperty,null,myToolTip,null); IntPtr hwnd = (IntPtr) o; SendMessage(hwnd,0x0418, 0, 300); …..
In VS.NET, how can I specify the start up project for my application?
In the Solution Explorer right click on the project that should be the start up project for your application and choose the Set As Start Up Project option.