WinForms應用程式全螢幕顯示及隱藏工作列
要讓WinForms應用程式實現真正的全螢幕體驗,不僅需要隱藏標準視窗邊框,還需要隱藏工作列。
隱藏工作列
要隱藏工作列:
this.TopMost
設定為true
。 this.FormBorderStyle
設定為FormBorderStyle.None
。 this.WindowState
設定為FormWindowState.Maximized
。 <code class="language-csharp">private void Form1_Load(object sender, EventArgs e) { this.TopMost = true; this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; }</code>
自動隱藏選單列
要自動隱藏選單列:
AutoSize
屬性設定為true
。 Dock
屬性設定為DockStyle.Top
。 MenuStrip_MouseLeave
事件並將Visible
屬性設定為false
。 <code class="language-csharp">private void MenuStrip_MouseLeave(object sender, EventArgs e) { this.MenuStrip.Visible = false; }</code>
以上是如何使 WinForms 應用程式真正全螢幕並隱藏工作列?的詳細內容。更多資訊請關注PHP中文網其他相關文章!