Hello again,
A new tip for windows forms developers, If you ever wantedto gain more control on the windows form you might have need the Minimizebox pressed event, and Maximizebox pressed too.
So all you need is to override the WndProc of the form and check for the Windows message of the (minimize , maximize , restore) and then raise the appropriate event.
I provided here a sample.
protected override void WndProc( ref Message m) {
if (m.Msg == WM_SYSCOMMAND)
{
switch (m.WParam.ToInt32())
{
case SC_MINIMIZE: OnMinimized(EventArgs.Empty);
break;
case SC_MAXIMIZE: OnMaximized(EventArgs.Empty);
break;
case SC_RESTORE: OnRestored(EventArgs.Empty);
break ;
default :
break;
}
}
base.WndProc(
ref m);
}
For a full windows constants here.
For more about WM_SYSCOMMAND here.