【发布时间】:2013-08-05 14:14:39
【问题描述】:
我在运行时创建表单的控件,出于某种原因,我需要深度超过 49 个嵌套控件(即控件包含在另一个控件中)。
但出现以下错误:
如何添加更多相互嵌套的控件?
这里有一小段代码可能会重现错误:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Panel lastPanel = panel1;
for (int i = 0; i < 49; i++)
{
Console.WriteLine(i);
Panel newPanel = new Panel();
lastPanel.Controls.Add(newPanel);
lastPanel = newPanel;
}
}
}
【问题讨论】:
-
“我需要超过 49 个嵌套控件的深度” - 你真的吗?
-
@MitchWheat 嗯嗯确实是的
标签: c# .net windows-forms-designer nested-controls