70
votes

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

10 Answers

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

in c#.net

this.WindowState = FormWindowState.Minimized
11
votes
<form>.WindowState = FormWindowState.Minimized;
8
votes
Form myForm;
myForm.WindowState = FormWindowState.Minimized;
3
votes

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

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

-- c#.net

NORMALIZE this.WindowState = FormWindowState.Normal;

this.WindowState = FormWindowState.Minimized;

0
votes

this.WindowState = FormWindowState.Minimized;

-1
votes
this.MdiParent.WindowState = FormWindowState.Minimized;
-4
votes
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Me.Hide()

End Sub