Is there a way to programmatically minimize a window


Question

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
53
10/9/2013 4:41:48 AM

Accepted Answer

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
     if(e.KeyChar == 'm')
         this.WindowState = FormWindowState.Minimized;
}
95
9/25/2008 11:16:14 AM

FormName.WindowState = FormWindowState.Minimized;

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon