How To: Allow the Player to Resize a Game Window
Demonstrates how to let the player resize the game window.
The 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.
Adding Window Resizing Functionality
To add player window resizing to a game
Derive a class from Game.
Set Game.GameWindow.AllowUserResizing to true.
Add an event handler for the ClientSizeChanged event of Game.Window.
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
this.Window.AllowUserResizing = true;
this.Window.ClientSizeChanged += new EventHandler(Window_ClientSizeChanged);
Implement a method to handle the ClientSizeChanged event of Game.Window.
void Window_ClientSizeChanged(object sender, EventArgs e)
// Make changes to handle the new window size.