表格布局面板滚动条 [英] Table layout panel scroll bar
问题描述
给定一个具有2列和许多行的表布局面板,我如何为其附加滚动条,因为有时滚动条的增长远大于表单的大小.
given a table layout panel with 2 columns and many rows, how can i attatch a scroll bar to it as sometimes it grows much greater than the size of the form .
谢谢
推荐答案
TableLayoutPanel
是 ScrollableControl
.因此,您可以将其AutoScroll
属性设置为True,并且当控件的首选大小超过其当前大小时,该控件将自动创建滚动条.这将为您提供所需的效果,而麻烦最少.
The TableLayoutPanel
is an example of a ScrollableControl
. You can therefore set it's AutoScroll
property to True and the control will automatically create scroll bars when it's preferred size exceeds its current size. This will provide you with the desired effect with minimal hassle.
过程
- 将
MaximumSize
属性设置为首选的最大大小,或者可以将TableLayoutPanel停靠在窗体中. - 将TableLayoutPanel的
AutoScroll
属性设置为true.
- Set the
MaximumSize
property to a preferred maximum size or you can dock the TableLayoutPanel in your form. - Set the
AutoScroll
property of the TableLayoutPanel to true.
仅供参考:
Panel,ToolStrip,FlowLayoutPanel,SplitterPanel,TableLayoutPanel,TabPage和ToolStripContentPanel都继承ScrollableControl
类,因此此答案也适用于它们.
FYI:
The Panel, ToolStrip, FlowLayoutPanel, SplitterPanel, TableLayoutPanel, TabPage and ToolStripContentPanel all inherit the ScrollableControl
class so this answer applies to them as well.
这篇关于表格布局面板滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!