Reputation: 649
I have a parent container panel that contains a :
Form :Usercontrol (Just has buttons to navigate the documents viewer) Grid : Documentsviewer
This parent container panel is docked on the Left of the screen (right is for document preview)
How can i make the Grid to occupy about 80% Of the available left space, while the Form has about 20% ?
Not matter what i do like setting the dockstyle to Top for the Grid and Bottom for the second, the size of the form is almost as large as the grid. Even changing the size of the form in properties doesn't make any changes. Also Autosize is disabled for both.
Upvotes: 0
Views: 1203
Reputation: 125197
When you need control layout with percentage in windows forms, TableLayoutPanel
is a good option.
You can use a TableLayoutPanel
with 1 row and 2 columns and set column 1 width to 20% and column 2 width to 80%. Then you can put your desired controls to its cells and set Dock
property of those controls to Fill
.
You can configure rows and columns using RowCount
, ColumnCount
, Rows
and Columns
properties.
Upvotes: 2