Time for action – adding event handlers
Add the following directive to the top of the Level Editor project's
Game1
class:Imports Tile_Engine
Add the following declaration to the declarations area of the
Game1
class of the Level Editor project:Private gameForm As System.Windows.Forms.Control
Add the following code to the constructor of the
Game1
class:gameForm = System.Windows.Forms.Control.FromHandle(Me.Window.Handle) AddHandler gameForm.VisibleChanged, AddressOf gameForm_VisibleChanged AddHandler pictureBox.SizeChanged, AddressOf pictureBox_SizeChanged
Add the two event handlers to the
Game1
class:Private Sub gameForm_VisibleChanged(sender As object, e as EventArgs) If gameForm.Visible Then gameForm.Visible = False End If End Sub Private Sub pictureBox_SizeChanged(sender As object, e As EventArgs) If (parentForm.WindowState <> System.Windows.Forms.FormWindowState.Minimized) Then graphics.PreferredBackBufferWidth = pictureBox.Width graphics.PreferredBackBufferHeight...