如何使用TableLayout实现一行两列第二行单列
我想要第一行有两列,第二行有单列。我将尝试添加列,但它不会添加到第一行。为两行添加列。如何解决这个问题?当设置某些标志时,我还需要隐藏第一行和第一列。
I want first row having two columns and second row with single column. I will try to add column but it is not getting added for first row. Column is added for two rows. How to solve this issue? I need to hide first row and fist column also when certain flag is set.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有两个选择:
第一个:
ColumnSpan
TableLayoutPanel
。ToolStrip
)。Button
(尽管我不明白为什么不在工具栏上添加一个额外的按钮)。ColumnSpan
属性设置为 2,这将使其延伸到底部的两个列。第二:嵌套
TableLayoutPanel
实例TableLayoutPanel
(TP1)。TableLayoutPanel
(TP2) 到 TP1 的顶行,1 行 2 列。Button
放在 TP2 的右栏中。Visible
属性设置为false
时,TP2 的左列将消失,右列现在将覆盖整个顶行。我认为解决方案 2 更适合您的需求,因为隐藏 TP2 的左栏会更容易。
You have two options here:
First:
ColumnSpan
TableLayoutPanel
with 2 rows and 2 columns.ToolStrip
).Button
(although I don't understand why not add a extra button to the toolbar).ColumnSpan
property to 2, which will cause it to stretch over both bottom columns.Second: Nested
TableLayoutPanel
InstancesTableLayoutPanel
(TP1) with 2 rows and 1 column.TableLayoutPanel
(TP2) to the top row of TP1, with 1 row and 2 columns.Button
in TP2's right column.Visible
property tofalse
, TP2's left column will disappear and the right column will now stretch over the whole top row.I think solution 2 will better fit your needs because it'll be easier to hide TP2's left column.