Click here to Skip to main content
15,895,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I resize the form size and its fields size when the screen resolution changes?
Posted
Updated 5-Sep-12 1:44am
v4
Comments
BillWoodruff 4-Sep-12 10:27am    
Please tag your question: WinForms ? WPF ? VB ?
thalir 4-Sep-12 23:59pm    
winforms ---- How do I resize the form size and its fields size when the screen resolution changes?
BillWoodruff 5-Sep-12 7:05am    
Please learn how to use Tags while posting a question: it's very easy. When you select "Ask a Question:" the second text field, with the green Icon 'Tags to the left of it, is where you enter things like C#, WindowsForms, etc. And each word you type activates a drop-down where you can choose from the available Tags: they are automatically inserted in a comma-delimited list that might look like: "C#, WinFrom, Win7, VisualStudio2012," for example.

Here[^]'s a good explanation on designing resizable forms.

If you mean that you want to resize all controls and maintain aspect ratio etc, then you need to use a 3rd party library. This[^] is really good...
 
Share this answer
 
v2
When it concern with windows application it all depents on design,
1) Use table layout panel make it Doce = Fill for the page
2) Define rows and columns as per your control needs
3) Put controls in cell and apply Anchor property to Top, Left (Or as per your setting)


===============
Just need to say it all depends upon Dock and Enchor property..!!
 
Share this answer
 
There are some third party products that provide this as well.
How this[^] one is not free.
 
Share this answer
 
We may be talking about three different things here:

1. handling a change in screen resolution: when your application is running: your application is not going to have "focus," and the standard EventHandlers, like SizeChanged (in WinForms) are not going to be called.

If you really want your running app to detect a change in screen resolution: the answers you need are here:[^].

It's hard for me to imagine a situation where screen resolution changes while an application is running (?) If you have to handle this (rare ?) case, I wonder what requires you to code for this.


2. dealing with scaling and positioning of Form elements when the Form size is changed (while, obviously, your application is running).

The article that Johnny J. referred you to (deservedly upvoted) should give you some strong clues about how to roll-your-own re-sizing and re-positioning, using Panels.

I have not had the bad experience using Dock, and Anchor, that the author of the article that Johnny J. linked to describes with such "horror."


3. detecting when your application starts the aspect ratio of the current display, and, if your layout is based on a different aspect ratio, adjusting all the controls ?

Of course a big reason many people changed to WPF is: you get automatic scaling for "free." On the other hand, since I don't use WPF, I would be interested to know if there is aspect/ratio correction if you change screen resolution while running a WPF application: I think I'll post a question on this on the WPF forum out of curiousity, but keep in mind that WPF is "history."

No way I'll pay US $200 for either of the third-party controls for WinForms described here :)

good luck, Bill
 
Share this answer
 
v3
Docking can help of course. Just look in the Properties of the control how you want to be resolution independent and set the docking, then the control automatically resizes too when the form does.
For more please see this CP article;
Anchoring, Docking Properties of Controls in Windows Forms:
Working with Anchoring and Docking Properties[^]

Anchor and Dock Child Controls[^]
Anchor and Dock Child Controls[^]

Also have look on similar discussions, you will get surely needful from them:
Zom Out malfunctions when Screen resolution changes[^]
GUI Apperance - C#.Net[^]
how to dock button so that it can adjust with the form[^]
 
Share this answer
 
Have a utility class ---- in the utility class based on resolution of your screen re size the controls. call the function of the utility class in form load () . the utility class method takes form instance as parameter.
 
Share this answer
 

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