Change the way x closes a form

J

Jon Brunson

Is it possible to change the way the x button in the top right closes a
form? Currently it just "smart minimises" the form, but I want it to be
able to act like the OK button, and actually close the form. Is there a
way to do this? Or, at least, an event that gets fired when the x is
clicked, so that I could close it manually?
 
C

Chris Tacke, eMVP

So you deliberately want your app to work opposite the way every other PPC
app works? I admit it's confusing, but it's worse to have different apps on
the same device work differently. If you wan't the app to close, use a menu
item.

-Chris
 
J

Jon Brunson

Perhaps I should explain more.

I'm writing a program for a customer where they select, from a list (on
FormA), one of many a procedures to run. This procedure then loads in
FormB (FormB.ShowDialog()). If, however, the user wants to cancel out of
the procedure, they sould be able to click the x button, and return to
the procedure list (FromA). Clicking an OK button would be a
contradiction in terms, as infact they'd want to Cancel, not Confirm.
However, if I set FormB.Minimise = True, and showed the x button, it
wouldn't close the form, and thus not run the code after the
FormB.ShowDialog(). Infact, it would render the program usless until you
"smart maximised" (if such a thing exists) FormB and continuted the
procedure.

I've never understood the reason why Microsft even smart-minimises
programs. Most of the time you don't want to resume from where you left
an application, and those which you do (File Explorer) save that
information when you exit the application anyway. But hey, that's
another story.

Is there a way to handle the resize event when the form gets minimised,
like you can in VB6/Full.NET?
 

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

Top