WPF 获取动态添加控件的值

ArrayList list = new ArrayList();
for (int k = 0; k < 6; k++)
{
for (int p = 0; p < 11; p++)
{
Label labs = new Label();
labs.HorizontalAlignment = HorizontalAlignment.Left;
labs.VerticalAlignment = VerticalAlignment.Top;
labs.Margin = new Thickness(599 + (17 * p), 206 + (17 * k), 0, 0);
labs.Name = "lab" + k + p;
labs.Width = 16;
labs.Height = 16;

list.Add(labs);
main.Children.Add(labs);
}
}

我动态添加一些Label,并放入ArrayList中,后面我要遍历ArrayList,获取每个Label的值,对每个Label进行操作,要怎么写?


素胚勾勒不出你
浏览 925回答 2
2回答

幕布斯6054654

foreach就可以啊
打开App,查看更多内容
随时随地看视频慕课网APP