Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////// Add this in a new file called NativeMethods.cs, in the public class NativeMethods
- #region ShowWindow
- // From: http://www.pinvoke.net/default.aspx/user32.ShowWindow
- [DllImport("coredll.dll")]
- public static extern bool ShowWindow(IntPtr hWnd, WindowShowStyle nCmdShow);
- public enum WindowShowStyle : uint
- {
- Hide = 0,
- ShowNormal = 1,
- ShowMinimized = 2,
- ShowMaximized = 3,
- Maximize = 3,
- ShowNormalNoActivate = 4,
- Show = 5,
- Minimize = 6,
- ShowMinNoActivate = 7,
- ShowNoActivate = 8,
- Restore = 9,
- ShowDefault = 10,
- ForceMinimized = 11
- }
- #endregion
- /////// Add this member variable to the Form
- private System.Windows.Forms.Timer showWindowTimer;
- /////// Add this to the constructor
- showWindowTimer = new System.Windows.Forms.Timer();
- showWindowTimer.Enabled = false;
- showWindowTimer.Interval = 250;
- showWindowTimer.Tick += new EventHandler(showWindowTimer_Tick);
- /////// Add this method to the form class
- void showWindowTimer_Tick(object sender, EventArgs e)
- {
- NativeMethods.ShowWindow(this.Handle, NativeMethods.WindowShowStyle.Show);
- }
- /////// Add this line to the bottom of MakeVisible()
- showWindowTimer.Enabled = true;
- /////// Add this line to the top of Dismiss()
- showWindowTimer.Enabled = false;
Add Comment
Please, Sign In to add comment