Simple Question on Docking Settings?

G

Guest

Hello

Thanks for reviewing my question. I have a simple question. I would like to know how you can arrange the docking order? For example, when I add a toolbar and I set the dock to TOP and then add a listview and set its dock to LEFT, the listview goes to left top to left bottom and my toolbar is now smaller because it was pushed over by the listview. What I want is to have toolbar top left to top right and the listview's top starting at the place below the toolbar to the bottom of the form. (I hope explained it clearly.

Many Thanks to the Exper
Peter
 
M

Morten Wennevik

Hi Peter,

You can try using panels. Put a panel with DockStyle.Fill beneath your
toolbar, and the ListView inside that panel.

Happy coding!
Morten Wennevik [C# MVP]
 
C

C# Learner

Peter wrote:

For example, when I add a toolbar and I set the dock to TOP and
then add a listview and set its dock to LEFT, the listview goes
to left top to left bottom and my toolbar is now smaller because
it was pushed over by the listview.

This doesn't happen here. When I set the ListView's Dock to Left, the
ToolBar doesn't resize at all.

Can you give exact instructions on how to replicate the problem?

<snip>
 
B

Bern Taylor

This is controlled by the order the controls are added to the form:

this.Controls.AddRange(new System.Windows.Forms.Control[]
{this.listView1,this.toolBar1});

Change the order to {this.toolBar1, this.listView1} and you will change
the effect.

Bern


Peter said:
Hello,

Thanks for reviewing my question. I have a simple question. I would like
to know how you can arrange the docking order? For example, when I add a
toolbar and I set the dock to TOP and then add a listview and set its dock
to LEFT, the listview goes to left top to left bottom and my toolbar is now
smaller because it was pushed over by the listview. What I want is to have
toolbar top left to top right and the listview's top starting at the place
below the toolbar to the bottom of the form. (I hope explained it clearly.)
 

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