表格布局面板滚动条

给定一个包含2列和多行的表布局面板,如何将滚动条附加到它上面,因为它有时会比表单的大小增长得多。

谢谢

TableLayoutPanelScrollableControl一个示例。 因此,您可以将其AutoScroll属性设置为True,并且当首选大小超过其当前大小时,控件将自动创建滚动条。 这将为您提供所需的效果,最小的麻烦。

程序

  1. MaximumSize属性设置为首选的最大大小,或者可以将TableLayoutPanel停靠在表单中。
  2. 将TableLayoutPanel的AutoScroll属性设置为true。

供参考:
Panel,ToolStrip,FlowLayoutPanel,SplitterPanel,TableLayoutPanel,TabPage和ToolStripContentPanel都inheritance了ScrollableControl类,因此这个答案也适用于它们。

快捷方式:

 tableLayoutPanel1.MaximumSize = new Size(tableLayoutPanel1.Width, tableLayoutPanel1.Height); tableLayoutPanel1.AutoScroll = true;