I'm looking for an event from a form that called after a window is maximized or minimized.
As far as I know there is such event as SizeChanged or WndProc that can handle maximized window, but it's called right away after user try to maximize the window, and it's not called after the window is fully maximized.
I'm looking for event like ResizeEnd, but maybe this one is called MaximizedEnd or MinimizedEnd
Is there anyway to do that?
I think it's as simple as this:
protected override void OnSizeChanged(EventArgs e) {
if (this.WindowState == FormWindowState.Maximized) {
MessageBox.Show("Max!");
}
base.OnSizeChanged(e);
}
Not sure what you mean by after the window is sized. This might work, too:
protected override void OnSizeChanged(EventArgs e) {
if (this.WindowState == FormWindowState.Maximized) {
this.BeginInvoke(new MethodInvoker(delegate { MessageBox.Show("Maxed"); }));
}
base.OnSizeChanged(e);
}
Replace the MessageBox.Show(...)
with your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With