积极答复者
不知是否为微软的bug或者是限制?可能是限制?

问题
-
源码如下,,将 48改为 49 即崩溃,,
是否微软讲窗体内控件的嵌套层数限制为49呢? 加上窗体50层?有什么办法可以突破限制么?或者是我的设置有些问题?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace TestPanel
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}private void Form1_Load(object sender, EventArgs e)
{
this.Controls.Add(endp);
doit(endp).Paint+=new PaintEventHandler(PaintPanel);
}void PaintPanel(object sender, PaintEventArgs e)
{
e.Graphics.FillRectangle(Brushes.Black, new Rectangle(10, 10, 50, 50));
// throw new NotImplementedException();
}
Panel endp = new Panel();
int i = 0;
Panel doit(Panel e)
{
if (i++ >= 48)
return e;
Panel p = new Panel();
p.Dock = DockStyle.Fill;
e.Controls.Add(p);
return doit(p);
}
}
}