我有这个 for 循环:
int iPanelNumber = 1;
foreach (string[] Persons in alItems)
{
Panel pPanelContainer = new Panel();
pPanelContainer.Width = contentPanel.Width;
pPanelContainer.Height = 50;
pPanelContainer.BackColor = Color.FromArgb(
Convert.ToInt32(aWhiteContentBackgroundColors[0]),
Convert.ToInt32(aWhiteContentBackgroundColors[1]),
Convert.ToInt32(aWhiteContentBackgroundColors[2]));
pPanelContainer.Name = "PanelContainer" + iPanelNumber.ToString();
pPanelContainer.Visible = false;
pPanelContainer.Location = new Point(0, 0);
}
如您所见,我已将创建的面板命名为“PanelContainer1”、“PanelContainer2”等...
但我怎样才能接触到这些面板?
我当然无法通过以下方式联系到他们:
PanelContainer1.visible = true;
有人有想法吗?
提前致谢