Time for action – handling the FormClosed event
Open the
MapEditor
form in Design mode.Select the form as the current object by clicking on the form's title bar in the Design window.
Switch to Event editing mode in the Properties window by clicking on the lightning bolt button.
Scroll down to the
FormClosed
event, and double-click in the empty box to the right of the event name to create theMapEditor_FormClosed()
event handler.Add the following code to the
MapEditor_FormClosed()
event handler:game.Exit() Application.Exit()
What just happened?
When the form closes, we need to shut down both the XNA game and the overall application, otherwise the system will not release the resources, and the program will still be running invisibly in the background.
Have a go hero
The Gemstone Hunter Level Editor project is fairly rough around the edges. It is not exactly a model example of Windows Forms development, but then few purpose-built internal game development tools are.
If you feel like diving further...