How to disable horizontal scrollbar for table panel in winforms

前端 未结 9 1092
栀梦
栀梦 2020-12-10 11:54

Hi I\'ve a tablelayoutpanel and I\'m binding controls to it dynamically. When the item count exceeds the height of panel obviously vertical scroll bar appearing there is no

9条回答
  •  抹茶落季
    2020-12-10 12:36

    This worked perfectly in .NET 3.5 where the other solutions did not give me exactly what I wanted:

      if (this.TableLayoutPanel1.HorizontalScroll.Visible)
      {
        int newWid = this.TableLayoutPanel1.Width -
                      (2 * SystemInformation.VerticalScrollBarWidth);
        //this.TableLayoutPanel1.Padding = new Padding(0, 0, newWid, 0);
        foreach (Control ctl in this.TableLayoutPanel1.Controls)
        {
          ctl.Width = newWid;
        }
      }
    

提交回复
热议问题