我所做的是我有一个全屏的表单,没有标题栏,因此缺少右上角的最小化/最大化/关闭按钮。我想用键盘快捷键和上下文菜单项替换这个功能,但似乎找不到触发事件来最小化表单。
FormName.WindowState = FormWindowState.Minimized;
<form>.WindowState = FormWindowState.Minimized;
Form myForm; myForm.WindowState = FormWindowState.Minimized;
private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if(e.KeyChar == 'm') this.WindowState = FormWindowState.Minimized; }
在 c # . net 中
this.WindowState = FormWindowState.Minimized
对已经最小化的形式进行最小化是没有意义的,所以我们开始吧:
if (form_Name.WindowState != FormWindowState.Minimized) form_Name.WindowState = FormWindowState.Minimized;
this.MdiParent.WindowState = FormWindowState.Minimized;
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Hide() End Sub
C # . net
正常点 正常;
最小化;
this.WindowState = FormWindowState.Minimized;