Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Resizing a Game

Demonstrates how to resize an active game 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.

Adding Window Resizing Functionality

To add player window resizing to a game

  1. Derive a class from Game.

  2. Set Game.GameWindow.AllowUserResizing to true.

  3. Add an event handler for the ClientSizeChanged event of Game.Window.

    this.Window.AllowUserResizing = true;
    this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);
    
  4. 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.            
    }
    

Community Additions

ADD
Show:
© 2015 Microsoft