You cannot directly get Events from the non-Client area of a Win Form; you can get those Events using Win API calls.
However, in the case of a mouse-action on the Close Button of a Form, and in case of the clicks on Maximize, and Minimize Buttons in the TitleBar, you can get those Events by defining EventHandlers for the Form 'Closing, 'Close, and 'Resize Events.
If you define this Form Closing EventHandler:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
if(SomeConditionYouDefine) e.Cancel = true;
}
}
This will be triggered before the Form is closed, and you can recognize if the Form was closed by a click on the ControlBox by testing e.CloseReason.
If you set e.Cancel to 'true in the Closing EventHandler, then the Form will not close.
For Minimize and Maximize Button clicks, you can define an EventHandler for the Form 'Resize Event, and take action based on the current WindowState after each resize:
private void Form1_Resize(object sender, EventArgs e)
{
switch (this.WindowState)
{
case FormWindowState.Minimized:
break;
case FormWindowState.Maximized:
break;
case FormWindowState.Normal:
break;
}
}