您的位置:程序门 -> .net技术 -> c#



c#中怎样获得window上的button个数


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


c#中怎样获得window上的button个数[已结贴,结贴人:paradise885]
发表于:2007-03-14 15:58:54 楼主
c#中怎样获得window上的button个数
发表于:2007-03-14 16:00:571楼 得分:5
只能是做一个循环了:
int   count   =   0;
foreach   (control   c   in   this.controls)
{
if   (c   is   button)
{
count++;
}
}
system.console.writeline( "button的个数为: "   +   count.tostring());


快速检索

最新资讯
热门点击