URGENT:Resolution Problem  
Author Message
Rahul Saxena





PostPosted: Windows Forms General, URGENT:Resolution Problem Top

 

Hi all,

              I having the big application having several forms and controls over it. I developed that application in the environment 1024 * 768 resolution. The probelm is that when we change the resolution, my application does not show the forms and controls over it correctly, if we increase the resolution, the forms goes outside the screen, if we decrease the resolution, the the controls over the contol get shrink and form do not shrink in the same ratio, it shows the unnessary gap between the forms and control over it.

Can anybody tells me the solution for this, my reqirement is my application should always shown with in the screen of the monitor,  even what ever the resolution of the system is, It should work as a like a standard application works like Visual Studio etc. I want to cnange the resolution of my system programatically, beacuse it will effect the other applications.

 

Thanks in Advance

Rahul 

 



Windows Forms35  
 
 
Ken Tucker





PostPosted: Windows Forms General, URGENT:Resolution Problem Top

Controls have dock and anchor properties to help with form resizing

 
 
Chris Vega





PostPosted: Windows Forms General, URGENT:Resolution Problem Top

There is no "catch it all" solution for this kind of problem. Your best option is to play around with docking (Dock property) and/or anchoring (Anchor property) of your controls, then make smart adjustments for your form based on Screen.PrimaryScreen.Bounds values (if ever the resolution has changed).

If resolution changing is frequent in your application's environment, you may also want to attach an event handler to Microsoft.Win32.SystemEvents.DisplaySettingsChanged, so you can track any resolution changes and update your forms when that happens.

Try playing around with these first, and post any problems that you may encounter while coding, and we will be happy to help you.

Regards,

-chris

 
 
Rahul Saxena





PostPosted: Windows Forms General, URGENT:Resolution Problem Top

hi, thanks for your solution, actually I have been shifted to some other project, but will definitly try your solutions in my free time.

Once again thanks.


 
 
ansarali





PostPosted: Windows Forms General, URGENT:Resolution Problem Top

Hai ken Tucker,

I too facing the same problem as like rahul, could u please explain with some examples for anchor and dock to solve the problem.

Best Regards,

ansar

 



 
 
Ken Tucker





PostPosted: Windows Forms General, URGENT:Resolution Problem Top

The anchor property will keep the control a fixed a distance from edge of a form. The dock property will lock a control to the edge of the form or to fill the entire form.