XNA: get screen's width and height

RCIX picture RCIX · Sep 4, 2009 · Viewed 41.9k times · Source

how do i get the width and height of the entire screen in XNA?

Answer

Eddie Parker picture Eddie Parker · Nov 10, 2010

Empirically I've found that in XNA 4.0 I need to use

GraphicsDevice.Viewport.Width
GraphicsDevice.Viewport.Height

when running windowed mode, as I find

GraphicsDevice.DisplayMode.Width
GraphicsDevice.DisplayMode.Height 

gives me the resolution of the entire screen.

Hopefully this helps someone else out.