Abh*_*lar 24 c# tablelayoutpanel winforms c#-4.0
我有两行两列.我希望两个单元格的最后一列合并为一列.由于要求我不使用其他设计选项意味着两个tablelayout,其中第一个表布局有两行.我在C#中使用Winforms.
| | |
| | |
| | |
|_______________________| |
| | |
| | |
| | |
Run Code Online (Sandbox Code Playgroud)
以下是如何在代码中执行此操作
//create a label control, add it to the tableLayoutPanel, and merge it into 3 cells.
Label lbl = new Label();
lbl.Location = new Point(0, 0);
lbl.Text = "This is a test label";
MyTableLayoutPanel.Controls.Add(lbl, 0,0); //start it in cell 0,0
MyTableLayoutPanel.SetColumnSpan(lbl, 3); //merge 3 columns
Run Code Online (Sandbox Code Playgroud)
http://msdn.microsoft.com/zh-CN/library/system.windows.forms.tablelayoutpanel.aspx
例如,您可以在TableLayoutPanel控件中设置RowSpan Poperty。