【发布时间】:2012-11-21 20:42:27
【问题描述】:
我有一个panel,其中包含控件。控件是buttons 和progressbars。我只想将按钮添加到list,我该怎么做?
foreach (Control item in panel1.Controls)
{
//if (item.GetType() == typeof(ButtonControl)) //i tried this too...
if ((item is ButtonControl) && (item.Tag.ToString() == "It's not important"))
{
panel1.BtnList.Add(item);
}
}
这里ButtonControl是我自己的Control,继承自Button类。
【问题讨论】:
标签: c# winforms controls panel