Reputation: 463
I have a pretty simple winforms application. It contains a rich edit box, embedded browser, progress bar, a few buttons etc.
I have the anchors on the controls set to expand in all directions.
When expanding up and down, however, the controls will overlap one another. How do I prevent this from happening?
Thanks
Upvotes: 5
Views: 20864
Reputation: 16423
Your best bet is to add a TableLayoutPanel
to your form which contains the "layout grid" this should be docked to the form, then you can add your controls into the cells in the table (they can cover multiple rows and columns so you can get the layout you want).
Upvotes: 17
Reputation: 13043
You must set the property Autosize=true
on every control, especially on the main form.
Note that some controls like TabControl
have this property, but you can't see it with intellisense (Attribute Browseable=false
).
Upvotes: 0