Professional Documents
Culture Documents
Complete Sample
The code in this topic shows you the technique. You can download a complete code sample for this topic, including full source code and any additional supporting files required by the sample. Download GameLoop_Sample.zip.
C#
this.Window.AllowUserResizing = true; this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);
C#
void Window_ClientSizeChanged(object sender, EventArgs e) { // Make changes to handle the new window size. }
Game Class
Provides basic graphics device initialization, game logic, and rendering code. Namespace: Microsoft.Xna.Framework Assembly: Microsoft.Xna.Framework.Game (in microsoft.xna.framework.game.dll) Syntax C#
GameWindow.AllowUserResizing Property
Specifies whether to allow the user to resize the game window.
Property Value
true if user resizing is allowed; false otherwise.
GameWindow.ClientSizeChanged Event
Raised when the size of the GameWindow changes. Namespace: Microsoft.Xna.Framework Assembly: Microsoft.Xna.Framework.Game (in microsoft.xna.framework.game.dll) Syntax C#
Game.Window Property
Other Versions
C#
public GameWindow Window { get; }
Property Value
The underlying operating system window.
Complete Sample
The code in this topic shows you the technique. You can download a complete code sample for this topic, including full source code and any additional supporting files required by the sample. Download FullScreenWindows.zip.
PreferredBackBufferHeight to the desired screen height and width. 3. Set IsFullScreen to true. C#
this.graphics.PreferredBackBufferWidth = 480; this.graphics.PreferredBackBufferHeight = 800; this.graphics.IsFullScreen = true;