dky1e
June 21st, 2002, 01:07 PM
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...
thanks...
|
Click to See Complete Forum and Search --> : Intercept event for the 'x' button on window dky1e June 21st, 2002, 01:07 PM 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... dky1e June 24th, 2002, 09:58 AM ok.. I found a solution by overriding the OnClosing function: 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? CPCericola June 24th, 2002, 11:07 AM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |