Time for action – adding event handlers
Add the following directive to the Game1 class of the Level Editor project:
using Tile_Engine;
Add the following declaration to the declarations area of the Game1 class of the Level Editor project:
System.Windows.Forms.Control gameForm;
Add the following code to the constructor of the Game1 class:
gameForm = System.Windows.Forms.Control.FromHandle(this.Window.Handle); gameForm.VisibleChanged +=new EventHandler(gameForm_VisibleChanged); gameForm.SizeChanged +=new EventHandler(pictureBox_SizeChanged);
Add the two event handlers to the Game1 class:
private void gameForm_VisibleChanged(object sender, EventArgs e) { if (gameForm.Visible == true) gameForm.Visible = false; } void pictureBox_SizeChanged(object sender, EventArgs e) { if (parentForm.WindowState != System.Windows.Forms.FormWindowState.Minimized) { graphics.PreferredBackBufferWidth = pictureBox.Width; graphics.PreferredBackBufferHeight = pictureBox.Height...