using System;
namespace WinFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
label1.Text = this.WindowState.ToString();
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
// Set form KeyPreview property to True
if (e.KeyChar == 'm')
{
this.WindowState = FormWindowState.Minimized;
label1.Text = this.WindowState.ToString() + " : " + e.KeyChar.ToString();
}
}
}
}
/*
* run:
*
* Normal
* Minimized : m
*
*/