第1个回答 2009-01-07
动态控件方法
在程序运行时自动添加控件
这种方法
不需要一个个的在设计时画上去
如需要 还可以添加 事件 给这些控件 需要的话 可留言给我
dim p(9) as picturebox
form1_lode()...
dim i as integer
for i=0 to 9
p(i)=new picturebox
with p(i)
.sizemode=autosize
.image=new bitmap("c:/" & i & ".jpg")
.visable=false
end with
me.contorls.add(p(i))
end sub
button1_click()...
dim i,j as integer
i=int(rnd()*10)
for j=0 to 9
if i=j then
p(i).visable=true
else
p(i).visable=false
end if
next
end sub