The OnClosing event is not raised when the Close, X button is clicked. Windows Mobile

I am new to Windows Mobile and created an application that needs to be cleaned when the form is closed. When I click on Close in a ControlBox, it does not raise an OnClosing event. This works fine in regular windows, but does not work with my Windows Mobile device.

Here is my code:

protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { ... } 

I also tried this with no luck:

 Form.Closing += new System.ComponentModel.CancelEventHandler(WindBaseForm_Closing); 

I would be grateful for any help you can give.

+4
source share
1 answer

Right. The (X) button in Windows Mobile is called the Smart Minimize button and only minimizes the shape. Set the MinimizeBox property to false and it will change to (OK), which will close the form (and raise the event).

For details on why this happens, read this .

+9
source

All Articles