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



请教一个修改控件集的办法


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


请教一个修改控件集的办法[已结贴,结贴人:nevertime]
发表于:2007-10-11 15:46:01 楼主
在一个tabcontrol中我在每个tabpage中有很多label控件

我想一次性修改这些label控件的对象

例如把这些控件的背景颜色改成白色
我有写了一个不过没有调通,请指教
    dim   olabel   as   control
                for   each   olabel   in   me.tabcontrol1.tabpages
                        ctype(olabel,   label).backcolor   =   color.white
                next
但是不能达到预期的效果。。。
发表于:2007-10-11 18:43:021楼 得分:20
你的olabel得到的是tabpage对象,应该再在它的controls里面循环得到label空间.

vb.net code
for each page as tabpage in me.tabcontrol1.tabpages for each c as control in page.controls if c.gettype() is gettype(label) then c.backcolor = color.red end if next next
发表于:2007-10-12 16:17:252楼 得分:0
非常感谢,问题解决了。


快速检索

最新资讯
热门点击