|
-
June 21st, 2002, 01:07 PM
#1
Intercept event for the 'x' button on window
I want to minimize the window when a user clicks the 'x' button in the control box. How can I prevent the window from closing?
thanks...
-
June 24th, 2002, 09:58 AM
#2
ok.. I found a solution by overriding the OnClosing function:
Code:
protected override void OnClosing( System.ComponentModel.CancelEventArgs e )
{
e.Cancel = true;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
}
But I'm not sure if its enough, that is what happens when the program exits?
-
June 24th, 2002, 11:07 AM
#3
Have you tried hooking the public event, CancelEventHandler. According to the remarks from the documentation:
The Closing event occurs as the form is being closed. When a form is closed, all resources created within the object are released and the form is disposed. If you cancel this event, the form remains opened. To cancel the closure of a form, set the Cancel property of the CancelEventArgs passed to your event handler to true.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|