locked
Docking? RRS feed

  • Question

  • Hi all,

    I'm trying to make similar tab like "Computers & backup" - toolbar and listview below, but when I use the following code, the behaviour is not correct:

    ...

    topBar.Dock = DockStyle.Top;

    ...

    ListView = new FancyListView();

    ListView.Dock = DockStyle.Fill;

    ...

     

    from MSDN - Fill option - Fills all remaining space in the form

    - so, I think that listview should be docked below toolbar, but it's docked on the whole painting area and part of listview is covered by toolbar. Maybe I missed something (I'm novice in windows forms programming)... But how can I dock the listview in the same style like on "Computers & backup"?

     

    Many thanks for your responses!

    Thursday, June 14, 2007 6:03 PM

All replies

  • Try creating a Panel with the size that gets passed into your HomeServerTabExtender, and add & dock your ListView to that.
    Thursday, June 14, 2007 6:35 PM
  • This should get it...

    Code Snippet        public HomeServerTabExtender(int width, int height, IConsoleServices consoleServices)
            {

                this.width = width;
                this.height = height;
                this.services = consoleServices;

                tabControl = new Panel();
                tabControl.Width = width;
                tabControl.Height = height;

                ListView = new FancyListView();
               
    ListView.Dock = DockStyle.Fill;
                tabControl.Controls.Add(
    ListView.);

            }

    Thursday, June 14, 2007 6:51 PM
  • thanks to all, it makes sense, but the problem is when I need to dock 2 or more component (e.g. toolbar and list view). I can make

    following code to simulate docking:

    ListView.Location = new System.Drawing.Point(topBar.Location.X, topBar.Size.Height); // topBar is my toolbar object and listview is my list view object

    ListView.Size = new System.Drawing.Size(width, height - topBar.Size.Height);

    ListView.Dock = DockStyle.None;

     

    but I'm not sure whether it's clear solution, I think that DockStyle.Top (for toolbar) and DockStyle.Fill (for list view) should make it internally. But maybe I'm wrong...

     

    many thanks!

    Friday, June 15, 2007 1:02 PM
  •  czPaul wrote:

    Hi all,

    I'm trying to make similar tab like "Computers & backup" - toolbar and listview below, but when I use the following code, the behaviour is not correct:

    ...

    topBar.Dock = DockStyle.Top;

    ...

    ListView = new FancyListView();

    ListView.Dock = DockStyle.Fill;

    ...

     

    from MSDN - Fill option - Fills all remaining space in the form

    - so, I think that listview should be docked below toolbar, but it's docked on the whole painting area and part of listview is covered by toolbar. Maybe I missed something (I'm novice in windows forms programming)... But how can I dock the listview in the same style like on "Computers & backup"?

     

    Many thanks for your responses!

    It sounds like you have the Z-Order incorrect on your child controls. Try reversing the order you add the 2 child controls to the parent control

     

    Try both:

     

    Code Snippet

    this.Controls.Add(tabBar);

    this.Controls.Add(ListView);

     

     and

     

    Code Snippet

    this.Controls.Add(ListView);

    this.Controls.Add(tabBar);

     

     

    Hope this helps

    Jay

    Friday, June 15, 2007 5:20 PM