In Pocket PC applications, you either have an Minimize (X) or a Close (OK) button in the upper right corner. Minimize is the default, which keeps the application running in the background. You can change the X to OK by doing adding the following line to the Form's constructor or InitializeComponent() method:
' Change Minimize (x) to Close (ok)
Me.MinizeButton = False
To override the Closing event, add this method to your Form:
Private Sub Form1_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
MsgBox("Closing App")
' do stuff
End Sub
For more information about Pocket PC form factors using the .NET Compact Framework, see:
What device are you targeting Only custom WinCE devices show you all controlbox elements; PPCs have either an "X" or an "OK" in the top right corner which you can control with the MinimizeBox property.
See if handling the Closing/Closed events gets you where you want to be.
Probably the confusion is that "X" means close in Windows XP but Minimize in the mobile O.S., in my case I am using CE 5.0. So obviously the Closed event is not raised when the window is minimized, even though the X intuitively should be "close". Instead, "ok" means close. Just my two cents.
How can I override a handler for a Form ControlBox
How can I override a handler for a Form ControlBox
Jim Ransford
' Change Minimize (x) to Close (ok)
Me.MinizeButton = False
To override the Closing event, add this method to your Form:
Private Sub Form1_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
MsgBox("Closing App")
' do stuff
End Sub
For more information about Pocket PC form factors using the .NET Compact Framework, see:
http://msdn2.microsoft.com/en-us/library/bxz0e21k(en-US,VS.80).aspx
Also, see the Pocket PC User Interface Guidelines:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/guide_ppc/html/ppc_pcconapplicationhelpforpocketpcs.asp
Hope this helps,
- Bruce Hamilton
.NET Compact Framework User Education
squink
See if handling the Closing/Closed events gets you where you want to be.
Cheers
Daniel
komo
Me.MinimizeBox = False
Probably the confusion is that "X" means close in Windows XP but Minimize in the mobile O.S., in my case I am using CE 5.0. So obviously the Closed event is not raised when the window is minimized, even though the X intuitively should be "close". Instead, "ok" means close. Just my two cents.