/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { #if INSIDE_WINFORM WinFormContainer form = new WinFormContainer(); Application.EnableVisualStyles(); form.Show(); Game1 game = new Game1(form); form.game = game; game.Run(); #else using (Game1 game = new Game1()) { game.Run(); } #endif }
public Game1(WinFormContainer winFormContainer) : this() { // Set the drawing surface to be the picture box inside the WinForm. this.winFormContainer = winFormContainer; this.drawSurface = winFormContainer.getDrawSurface(); graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings); System.Windows.Forms.Control.FromHandle((this.Window.Handle)).VisibleChanged += new EventHandler(Game1_VisibleChanged); Mouse.WindowHandle = drawSurface; }