it-swarm.cn

有没有办法以编程方式最小化窗口

我正在做的是我有一个全屏幕形式,没有标题栏,因此缺少右上角的最小化/最大化/关闭按钮。我想用键盘快捷键和上下文菜单项替换该功能,但我似乎无法找到触发最小化表单的事件。

51
Stephen Wrighton
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
     if(e.KeyChar == 'm')
         this.WindowState = FormWindowState.Minimized;
}
93
John Dages
FormName.WindowState = FormWindowState.Minimized;
31
JP Richardson

在c#.net中

this.WindowState = FormWindowState.Minimized
18
chetan
<form>.WindowState = FormWindowState.Minimized;
10
Craig Eddy
Form myForm;
myForm.WindowState = FormWindowState.Minimized;
7
Stephen Deken

最小化已经最小化的形式是没有意义的。所以我们走了:

if (form_Name.WindowState != FormWindowState.Minimized) form_Name.WindowState = FormWindowState.Minimized;
2
profnotime

- c#.net

NORMALIZE this.WindowState = FormWindowState.Normal;

this.WindowState = FormWindowState.Minimized;

0
Thailor Souza