表格布局面板滚动条
给定一个包含 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 .
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
TableLayoutPanel
是ScrollableControl
的示例。因此,您可以将其AutoScroll
属性设置为 True,当其首选大小超过其当前大小时,该控件将自动创建滚动条。这将以最少的麻烦为您提供所需的效果。过程
MaximumSize
属性设置为首选的最大尺寸,或者您可以将 TableLayoutPanel 停靠在表单中。AutoScroll
属性设置为 true。仅供参考:
Panel、ToolStrip、FlowLayoutPanel、SplitterPanel、TableLayoutPanel、TabPage 和 ToolStripContentPanel 都继承了 ScrollableControl 类,因此这个答案也适用于它们。
The
TableLayoutPanel
is an example of aScrollableControl
. You can therefore set it'sAutoScroll
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.Procedure
MaximumSize
property to a preferred maximum size or you can dock the TableLayoutPanel in your form.AutoScroll
property of the TableLayoutPanel to true.FYI:
The Panel, ToolStrip, FlowLayoutPanel, SplitterPanel, TableLayoutPanel, TabPage and ToolStripContentPanel all inherit the
ScrollableControl
class so this answer applies to them as well..Net Framework WinForms
TableLayoutPanel
在AutoScroll
方面存在很多错误。最好避免使用此属性。有更好的解决方案。
我希望它们能够在 .Net Core WinForms 版本中得到修复。
.Net Framework WinForms
TableLayoutPanel
has a lot of bugs withAutoScroll
.It's better to avoid use this property. There is better solution.
I hope they will be fixed in .Net Core WinForms version.
快捷方式:
For shortcut :