How to tell when a form is minimizing or closing!

  • Thread starter Thread starter Tony Clark
  • Start date Start date
T

Tony Clark

Hi,

How can i tell when a form is minimizing or closing by use of the button in
the top right of the form?

thanks in advance
 
ok i got FormClosing event, but i cant see one for minimizing?

also is there a way, when the form is closing, of actually stopping it and
just hiding it, i want to have a notify icon, and when the form is closed
(so to speak) it just hides itself until the icon in the systray is clicked.

thanks
 
In the FormClosing event you can do this:

private void Form1_FormClosing(object sender,
FormClosingEventArgs e)
{
e.Cancel = true;
this.Hide();
}

The e.CloseReason property will also tell you if the form is closing by
the x button or some other reason.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top