Restore WindowState from Minimized

I use the following extension method: using System.Runtime.InteropServices; namespace System.Windows.Forms { public static class Extensions { [DllImport( “user32.dll” )] private static extern int ShowWindow( IntPtr hWnd, uint Msg ); private const uint SW_RESTORE = 0x09; public static void Restore( this Form form ) { if (form.WindowState == FormWindowState.Minimized) { ShowWindow(form.Handle, SW_RESTORE); } } } } … Read more

Winforms-How can I make MessageBox appear centered on MainForm?

It is possible with some servings of P/Invoke and the magic provided by Control.BeginInvoke(). Add a new class to your project and paste this code: using System; using System.Text; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; class CenterWinDialog : IDisposable { private int mTries = 0; private Form mOwner; public CenterWinDialog(Form owner) { mOwner = owner; … Read more