Reputation: 37850
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.
Upvotes: 79
Views: 139809
Reputation: 1
-- c#.net
NORMALIZE this.WindowState = FormWindowState.Normal;
this.WindowState = FormWindowState.Minimized;
Upvotes: 0
Reputation: 259
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
End Sub
Upvotes: -4
Reputation: 321
There's no point minimizing an already minimized form. So here we go:
if (form_Name.WindowState != FormWindowState.Minimized) form_Name.WindowState = FormWindowState.Minimized;
Upvotes: 3
Reputation:
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == 'm')
this.WindowState = FormWindowState.Minimized;
}
Upvotes: 125