Get and Set Screen Resolution

Bruce Powell III picture Bruce Powell III · Feb 22, 2011 · Viewed 159.7k times · Source

How can I collect and change screen resolution using Visual C#?

Answer

Donut picture Donut · Feb 22, 2011

For retrieving the screen resolution, you're going to want to use the System.Windows.Forms.Screen class. The Screen.AllScreens property can be used to access a collection of all of the displays on the system, or you can use the Screen.PrimaryScreen property to access the primary display.

The Screen class has a property called Bounds, which you can use to determine the resolution of the current instance of the class. For example, to determine the resolution of the current screen:

Rectangle resolution = Screen.PrimaryScreen.Bounds;

For changing the resolution, things get a little more complicated. This article (or this one) provides a detailed implementation and explanation. Hope this helps.