Controls alignment

A

Alan T

I would like to know how do I align the controls on th Win form:

Align TreeView on the left
Align ListView on the client area
Align datagridview to the right ?
 
B

Brendan Green

Set the TreeView Dock property to Left.
Set the DataGridView Dock property to Right.
Set the ListView Dock property to Fill.

(in that order)
 
L

Lennart

1) Add a panel, panel1, to the form and set Dock property to Left
2) Add a TreeView to panel1 and set Dock property to fill
3) Add a panel, panel2, to the form and set Dock property to Fill
4) Add a panel, panel3, to panel2 and set Dock property to Right
5) Add a DataGridView to panel3 and set Dock property to Fill
6) Add a panel, panel4 to panel2 and set Dock property to Fill
7) Add a ListView to panel4 and set Dock property to Fill

If you want to resize the TreeView ListView and DataGridView, add the
following steps
1A) Add a Splitter to form and set Dock property to Left
4A) Add a Splitter to panel2 and set Dock property to Right

If you add the panels in wrong order the panels that has Dock = Fill will go
behind the other panels.
/Lennart
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top