Is there a way to programmatically minimize a wind

2020-05-21 07:33发布

What I'm doing is I have a full-screen form, with no title bar, and consequently lacks the minimize/maximize/close buttons found in the upper-right hand corner. I'm wanting to replace that functionality with a keyboard short-cut and a context menu item, but I can't seem to find an event to trigger to minimize the form.

10条回答
不美不萌又怎样
2楼-- · 2020-05-21 07:50

this.WindowState = FormWindowState.Minimized;

查看更多
你好瞎i
3楼-- · 2020-05-21 07:55
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
     if(e.KeyChar == 'm')
         this.WindowState = FormWindowState.Minimized;
}
查看更多
地球回转人心会变
4楼-- · 2020-05-21 07:56
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Me.Hide()

End Sub
查看更多
smile是对你的礼貌
5楼-- · 2020-05-21 07:56
FormName.WindowState = FormWindowState.Minimized;
查看更多
狗以群分
6楼-- · 2020-05-21 07:56

There's no point minimizing an already minimized form. So here we go:

if (form_Name.WindowState != FormWindowState.Minimized) form_Name.WindowState = FormWindowState.Minimized;
查看更多
\"骚年 ilove
7楼-- · 2020-05-21 07:59
this.MdiParent.WindowState = FormWindowState.Minimized;
查看更多
登录 后发表回答