# ResolutionRrOrientationChanged

### Introduction

The ResolutionOrOrientationChanged event is an event which is raised whenever the game's resolution or orientation changes. This can happen if:

* The orientation changes (on a mobile or tablet)
* The user docks your game in Windows 8
* The user changes the window resolution - either through a command in the game or by resizing the window

### Code Example

This example assumes a desktop application. It will allow the user to resize a window by dragging the corner/edges. Whenever the user does this the new resolution will be printed to the screen. First, add the following code to your Screen's CustomInitialize:

```
FlatRedBallServices.Game.Window.AllowUserResizing = true;
```

To add the ResolutionOrOrientationChanged event:

1. Open or focus on Glue
2. Right-click on your Screen's Events item
3. Select "Add Event"
4. Verify "Expose an existing event" is selected
5. Use the drop-down to select "ResolutionOrOrientationChanged"
6. Click OK

Next, go back to Visual Studio and open your screen's Event file. If your screen is called "GameScreen" then the event file will be "GameScreen.Event.cs". Add the following code to OnResolutionOrOrientationChanged:

```
int newWidth = FlatRedBallServices.GraphicsOptions.ResolutionWidth;
int newHeight = FlatRedBallServices.GraphicsOptions.ResolutionHeight;

FlatRedBall.Debugging.Debugger.CommandLineWrite(
    "Resolution: " + newWidth +
    ", " + newHeight);
```

![ResolutionOutput.PNG](/files/jzxAlrxKtaYFRJEIvnmO)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flatredball.com/flatredball/glue-reference/events/glue-reference-resolutionororientationchanged.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
