Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am working on a winform application,from statring of this project i am getting problem with the screen resolutions,so i am trying to set screen resolution as per requirment through the coding when application get started ,how to do this...pls help
Posted

1 solution

Here is how to do it in System.Windows.Forms. As you don't have to actually create any form or application with this code, you can also use it in WPF.

Use System.Windows.Forms.Screen.AllScreens to get all your screens of the same type System.Windows.Forms.Screen. If you need only you primary screen, get just System.Windows.Forms.Screen.PrimaryScreen. Look at the properties of each screen. In particular, you can use System.Windows.Forms.Screen.WorkingArea and System.Windows.Forms.Screen.Bounds.

See http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.aspx[^].

Oops!

How to set screen resolution?!!

No, you cannot. Come on, you cannot have such requirement. Just the opposite, you have to write resolution-independent software. If you have requirements for the sizes of the windows, you can develop the UI the way it looks on the higher-resolution screen exactly as the same application on the base minimally required resolution. That's why you don't need to set resolution but only get it.
(I hope you understand that you cannot set resolution higher that it is physically possible no matter how strongly it is required :-).)

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900