Docking and anchoring

Can someone help me out? I have a number of controls on my windowes form and I want to make sure that controls and text enlarge and shrink when the screen resolution changes
LVL 35
YZlatAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Naman GoelPrinciple Software engineerCommented:
use layout control, table layout panels/flow layout panels based on your ui design dock them on parent form/control then drop your control accordingly and dock them on container control
YZlatAuthor Commented:
let me clarify, you mean use TableLayoutPanel?
Naman GoelPrinciple Software engineerCommented:
yes.
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

YZlatAuthor Commented:
Can you be more specific?

I have a picture box, two richtextbox controls, and two buttons. I need a picturer box up top, then two richtextbox controls one under the other and finally a row with two buttons
Jacques Bourgeois (James Burger)PresidentCommented:
No need for a TableLayoutPanel or other stuff like that for what you need to do, since the controls are layered on top of each other. The Anchor property is sufficient.

Anchor fix the margins around a control. You simply (however it is not always that simple :-)) set the margins that you want to stay fixed.

Let's start from the bottom. You probably to not want the buttons to enlarge, simply be sure that they stay at the bottom of the screen. So set their anchor property to Bottom. That fixes the margin between the bottom of the buttons and the bottom of the form. So, when you enlarge or reduce the form vertically, they stick to the same distance from the bottom. They will always be at the bottom of the form. Since you did not set lateral anchors, they will simply keep a relative position if the form is enlarged.

The RichTextBox controls, you might want to leave at the same heigth, but enlarge or reduce their width if the width of the form changes. Set their Right and Left anchors. Since the margin right and left is then fixed, they will enlarge horizontally. If you want them to stick to their same position relative to the buttons, also set their bottom anchor. So they will always keep the same distance from the bottom of the screen, going down with its lower border if the height of the screen gets bigger.

The PictureBox, you might want to enlarge in all directions. Set its Anchor property all around.

The idea is that, either horizontally, either vertically:

If you set both anchors, the control enlarge in that direction (horizontally or vertically).

If you set only one anchor, the control stays at the same position relative to the anchor you have set, and thus "follow" that border as the form resizes.

If set no anchor, the control keeps a relative position in that direction. So, if the control is 1/3 of the way up in the original form, but you did not set the Top and Bottom anchor, it will always stay 1/3 of the way up, no matter how big or small is the form.

Post a screenshot of the original form, and a screenshot of how you would like it to show when enlarged. I might be better able to help you to the proper settings if those I gave you here do not suit what you want to achieve.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YZlatAuthor Commented:
Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.