回复 10楼 lantian8134
是同样一个异常信息我容器都只放一个按钮的
判断的语句似乎没起作用
for (int i = 0; i < count; i++) { int val = random.Next(count); if (val != i) { temp = panels[i].Controls[0] as Button; panels[i].Controls.Clear(); panels[i].Controls.Add(panels[val].Controls[0] as Button); panels[val].Controls.Clear(); panels[val].Controls.Add(temp); } }
if (p.HasChildren) ((Button)p.Controls[0]).Visible = true;
for (int i = 0; i < count; i++) { int val = random.Next(count); if (val != i) { temp = panels[i].Controls[0] as Button; panels[i].Controls.Clear(); panels[i].Controls.Add(panels[val].Controls[0] as Button); panels[val].Controls.Clear(); panels[val].Controls.Add(temp); } }
if (p.HasChildren) ((Button)p.Controls[0]).Visible = true;