C#/.NET - WinForms - Instantiate a Form without showing it

前端 未结 18 1752
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 18:29

I am changing the Visibility of a Form to false during the load event AND the form still shows itself. What is the right event to tie this.Visible = false; to? I\'d like to

18条回答
  •  不思量自难忘°
    2020-12-05 18:44

    It took me some time to find a properly working Solution.

    Set the properties named WindowState to Minimized and ShowInTaskbar to False under properties window. Once your form is completly loaded, Call below lines of code.

            this.ShowInTaskbar = true;
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            //this.WindowState = System.Windows.Forms.FormWindowState.Normal;
    

    PS: This solution is Tested on Visual C# 2008 Express Edition

提交回复
热议问题