nested-controls

Control Nesting Limits in WinForms

余生长醉 提交于 2019-12-20 02:34:37
问题 I'm creating my form's controls in the runtime, and for some reason, I need the depth to be more than 49 nested controls (i.e. control is contained in another one). but the following error appears: How can I add more controls nested in each other ? Here is a little piece of code that may reproduce the error: 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();

Control Nesting Limits in WinForms

六月ゝ 毕业季﹏ 提交于 2019-12-01 22:57:06
I'm creating my form's controls in the runtime, and for some reason, I need the depth to be more than 49 nested controls (i.e. control is contained in another one). but the following error appears: How can I add more controls nested in each other ? Here is a little piece of code that may reproduce the error: 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; } } } According to Raymond Chen you cannot , it