Simple Question on Docking Settings?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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]
 
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>
 
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.)
 
Back
Top