Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anybody help me in getting Maximum Screen Resolution of the monitor by using C#, .NET particularly for windows application.
I got to know how to change the resolution but i m interested in getting maximum values in format Height x With example : 1280 x 768
User might be having any screen resolution range but how to get MAXIMUM possible Screen Resolution which can differ from Monitor to Monitor.
For changing resolution i had referred : http://bit.ly/dtZmQS which worked very well.
Posted

Take a look at this[^].

I find this site to be a little confusing, so in case it's not just me. :)

If you scroll down to just below the code listing there is a screen shot of what the Form should look like. So first create a Form with:
2 Labels
2 ListBoxes - named listDevices (top one) listSettings (bottom one)
1 Button - named btnSet

then copy the code from the site and paste it to replace the code in Form1.cs.

Then hook-up the listDevices_SelectedIndexChanged event handler to listDevices and away you go.

You could obviously hook-up the btnSet event handler too, if you are feeling adventurous. :-D

Good luck! :)
 
Share this answer
 
Comments
jpratik 15-Jun-10 7:10am    
How can i fetch maximum resolution values in terms of height and width for a particular monitor from user32.dll or from anywhere.But how can i derive maximum resolution of a screen through C# .NET
The code that I linked to enables you to get all the available resolutions for the device (they are listed in listSettings)
These items contain the resolution in height and width.

What you need to do is rather than add them to a ListBox is extract the figures from each, compare them to the largest found so far and if they are bigger save them as the largest, and so on.

The code was intended to show you that what you want to do is possible.

I am dreadfully sorry if it doesn't do precisely what you require but if you are not able to extrapolate from that code to your requirements then maybe programming is not the correct outlet for your talents.
 
Share this answer
 
v2
You can use System.Windows.Forms.Screen.GetBounds() to get total size.

Link Here[^] may help.
 
Share this answer
 
Comments
jpratik 15-Jun-10 7:05am    
Reason for my vote of 1
Not Precise
jpratik 15-Jun-10 7:07am    
How to get Maximum Resolution of the Screen?
Above method gets bound for Specific control or of specific point.

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