Screen Resolution in C# 1.1  
Author Message
Venkata Prasad K





PostPosted: Visual C# IDE, Screen Resolution in C# 1.1 Top

Hello,

I designed an application in c# windows forms (.net 2003). I have some doubts about screen resolution.

1. When my application is starting, i want to change the system resolution depends on my application.
2. Changing the application settings depends on System resolution.Which is better one and give any ideas about changing the resolution.



Visual C#14  
 
 
David Jeavons





PostPosted: Visual C# IDE, Screen Resolution in C# 1.1 Top

Hi

I am sure that there are some API's available that will allow you to change a screen resolution but to be honest, I don't particularly think this is a good idea. Users generally set their resolutions to what works best for them and I am sure that they would not appreciate a particular piece of software changing it for them (especially the hard of sight).

Is there are a reason you need to change the resolution Could you not layout your form making use of the Anchor properties so that the form will look consistent on all resolutions

As for your second question, I am not sure I understand, could you elaborate

HTH


 
 
Mark Rendle





PostPosted: Visual C# IDE, Screen Resolution in C# 1.1 Top

You can discover the resolution of the screen your window is on by using the Screen class.


Screen screen = Screen.FromControl(this); // this is the Form control
MessageBox.Show(string.Format("Width = {0}; Height = {1}", screen.Bounds.Width, screen.Bounds.Height), "Screen Size");
MessageBox.Show(string.Format("Width = {0}; Height = {1}", screen.WorkingArea.Width, screen.WorkingArea.Height), "Working Area");

WorkingArea gives the usable area of the desktop, excluding the TaskBar and any other desktop-docked controls.