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.Update the event handler to read:
private void MapEditor_FormClosed( object sender, FormClosedEventArgs e) { 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...