假设你panel的ID是“pnl”
int iLblCnt = 0;
foreach (Control item in this.Controls)
{
if (item.Name == "pnl")
{
foreach (Control subitem in item.Controls)
{
if (subitem.GetType().Name == "Label")
{
++iLblCnt ;
}
}
}
}
可以根据FindContols来找panel里面的空间!
Qyouu
冉冉说
随时随地看视频慕课网APP
相关分类