protected override void OnClick(EventArgs e)
{
// Only if associated view is enabled to we perform an action
if (GetViewEnabled())
{
// If we do not provide an inert form
if (!KryptonForm.InertForm)
{
// Only if the mouse is still within the button bounds do we perform action
MouseEventArgs mea = (MouseEventArgs)e;
if (GetView().ClientRectangle.Contains(mea.Location))
{
// Toggle between minimized and restored
if (KryptonForm.WindowState == FormWindowState.Minimized)
KryptonForm.SendSysCommand(PI.SC_RESTORE);
else
KryptonForm.SendSysCommand(PI.SC_MINIMIZE);
// Let base class fire any other attached events
base.OnClick(e);
}
}
}
}