使用Horizo​​ntalScrollBar for TableLayoutPanel

时间:2016-03-31 17:12:26

标签: c# winforms tablelayoutpanel

我有一个Windows窗体,它包含一个TableLayoutPanel,我正在填充动态数量的自定义用户控件。只有一行和动态数量的列(表示我们想要的用户控件数)。我已经设置了.AutoSize = true和.GrowStyle = AddColumns,以便表格根据需要进行扩展。我现在遇到的问题是利用水平滚动条查看其余列。

现在,好像水平滚动条横跨整个表格。这意味着无法看到滚动条的最右侧。我希望这只能延伸到表格的末尾,而不是表格。

我还想调整滚动条,以便在点击它时(大小点击),表格只显示下一个用户控件。

以下是我尝试的内容:

    this.tableLayoutPanel1.HorizontalScroll.Enabled = true;
    this.tableLayoutPanel1.HorizontalScroll.Visible = true;
    this.tableLayoutPanel1.HorizontalScroll.LargeChange = customControl.Width;
    this.tableLayoutPanel1.HorizontalScroll.SmallChange = customControl.Width;
    this.tableLayoutPanel1.HorizontalScroll.Maximum = this.Width; // Here I am trying to set the max to the edge of the Form, and not the table, I don't believe this is the correct property.

另一件事,它现在实现的方式水平滚动条实际上​​并不起作用。我可以与它互动,但桌子不滚动。

0 个答案:

没有答案
相关问题