Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get and Set Screen Resolution

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

like image 367
Bruce Powell III Avatar asked Feb 22 '11 19:02

Bruce Powell III


People also ask

How do I find my perfect screen resolution?

Very simple. Go to 'settings,' then click 'system,' then click 'display,' then 'advanced display settings. ' The recommended resolution is your native resolution, and the one that you should be using.


1 Answers

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.

like image 153
Donut Avatar answered Sep 30 '22 12:09

Donut