首页 > 解决方案 > DockStyle.Fill 切断水平内容

问题描述

问题:TableLayoutPanel总是有一些水平内容被剪裁——似乎正是滚动条的宽度。

预期结果:我希望显示所有水平内容,没有水平滚动条。我想要显示垂直滚动条。

设置:我有一个PanelAutoScroll = True。在里面我有一个TableLayoutPanelDock = DockType.Fill 和 AutoScroll = True。我在设计视图中创建了这些,而不是以编程方式。

这是一个屏幕截图:

在此处输入图像描述

这是设计器代码:

'
'Panel1 - This is the Panel
'
Me.Panel1.AutoScroll = True
Me.Panel1.AutoScrollMinSize = New System.Drawing.Size(0, 100)
Me.Panel1.Controls.Add(Me.pnlColumns)
Me.Panel1.Location = New System.Drawing.Point(12, 12)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(566, 379)
Me.Panel1.TabIndex = 4
'
'pnlColumns - this is the TableLayoutPanel
'

Me.pnlColumns.AutoScroll = True
Me.pnlColumns.BackColor = System.Drawing.Color.Silver
Me.pnlColumns.ColumnCount = 3
Me.pnlColumns.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 75.0!))
Me.pnlColumns.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 150.0!))
Me.pnlColumns.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 341.0!))
Me.pnlColumns.Dock = System.Windows.Forms.DockStyle.Fill
Me.pnlColumns.Location = New System.Drawing.Point(0, 0)
Me.pnlColumns.Name = "pnlColumns"
Me.pnlColumns.RowCount = 14
Me.pnlColumns.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30.0!))
' other rows removed for brevity
Me.pnlColumns.Size = New System.Drawing.Size(566, 379)
Me.pnlColumns.TabIndex = 0

标签: vb.netwinforms.net-standard

解决方案


推荐阅读