Get the actual screen Width and Height on Windows 10 C# Monogame

Which is the correct way to find the actual Resolution of the Screen on a computer( lets say Windows but better if it works on all platforms) and set the game to that size? I tried all the ways I found on the Internet but none of the methods returned the actual screen resolution.

If I recall correctly, the width and height of the screen can be found in the GraphicsAdapter.DefaultAdapter.CurrentDisplayMode property.

Maybe I got the names wrong, let me know if I did. I’ll look in my game’s code to see how I did it.

that didn’t help. How do you write the code? :frowning:

This should help.

int w = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
int h = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;

Sorry, I’m in the middle of class rushing right now :stuck_out_tongue:


Thanks bro! That worked! Thanks a mil! :slight_smile: