Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 831
  • Last Modified:

TableLayoutPanel horizental scroll bar

In my winform app. I create on line a TableLayoutPanel , I add controls to the TableLayoutPanel, and then add the full TableLayoutPanel  to a panel control.
My problem is that when there is need for vertical scrool bar, the  horizental scroll bar is apearing eith no need.
How can I solve this?
Control ctrlToAddTo = this.panelOfObjects;
            TableLayoutPanel tlp = new TableLayoutPanel();            
                     tlp.CellBorderStyle = TableLayoutPanelCellBorderStyle.None;            
                     tlp.Width = this.Width-10;
           tlp.Height = this.Height;
                      tlp.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
                      tlp.Padding = new Padding(0, 0, 0, 0);
            
          
            foreach (PictureBox pb in listOfPb)            
            {               
                tlp.Controls.Add(pb);
            }
            tlp.ColumnCount = (ctrlToAddTo.Width - 60) / (tlp.Controls[0].Width);
            ctrlToAddTo.Width = (tlp.Controls[0].Width) * tlp.ColumnCount + 60;
            tlp.Width = ctrlToAddTo.Width;
            tlp.Height = ctrlToAddTo.Height;
            tlp.AutoScroll = true;            
            this.panelOfObjects.Controls.Add(tlp);

Open in new window

0
yaron89
Asked:
yaron89
  • 2
1 Solution
 
dmeerenCommented:
In wich browser is this? Is hope your site is not made with frames?? This behavior is mostly with framesets.
0
 
dmeerenCommented:
Sorry it is C#, in my head i was buzy with HTML...
0
 
puru1981Commented:
you can use HScroll property to set the visibility

tlp.HScroll=false;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now