This is what Gabriel’s decision will look in detail. I do not think there is an event for WindoStateChanged.
, , . , 3 . , , , m.Msg , , . WM_ http://www.autohotkey.com/docs/misc/SendMessageList.htm.
protected override void WndProc(ref Message m)
{
FormWindowState previousWindowState = this.WindowState;
base.WndProc(ref m);
FormWindowState currentWindowState = this.WindowState;
if (previousWindowState != currentWindowState && currentWindowState == FormWindowState.Maximized)
{
}
}
, 3 , . . , , . Yore .
public Form1()
{
InitializeComponent();
this.SizeChanged +=new EventHandler(Form1_SizeChanged);
FormMaximized += new EventHandler(Form1_FormMaximized);
_CurrentWindowState = this.WindowState;
if (_CurrentWindowState == FormWindowState.Maximized)
{
FireFormMaximized();
}
}
public event EventHandler FormMaximized;
private void FireFormMaximized()
{
if (FormMaximized != null)
{
FormMaximized(this, EventArgs.Empty);
}
}
private FormWindowState _CurrentWindowState;
private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized && _CurrentWindowState != FormWindowState.Maximized)
{
FireFormMaximized();
}
_CurrentWindowState = this.WindowState;
}
void Form1_FormMaximized(object sender, EventArgs e)
{
}