Is there a way to programmatically minimize a wind

2020-05-21 07:34发布

问题:

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.

回答1:

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
     if(e.KeyChar == 'm')
         this.WindowState = FormWindowState.Minimized;
}


回答2:

FormName.WindowState = FormWindowState.Minimized;


回答3:

in c#.net

this.WindowState = FormWindowState.Minimized


回答4:

<form>.WindowState = FormWindowState.Minimized;


回答5:

Form myForm;
myForm.WindowState = FormWindowState.Minimized;


回答6:

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

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


回答7:

-- c#.net

NORMALIZE this.WindowState = FormWindowState.Normal;

this.WindowState = FormWindowState.Minimized;



回答8:

this.WindowState = FormWindowState.Minimized;



回答9:

this.MdiParent.WindowState = FormWindowState.Minimized;


回答10:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Me.Hide()

End Sub