您的位置:首页 > 其它

运行时动态添加和删除控件

2005-10-15 15:40 274 查看
1、使用控件数组。
dim i as int
load optch(1)
optch(1).visible=true
i=i+1
load optch(i)
with optch(i)
.caption"button" &i
.top=optch(i-1).top+300
.visible=true

end with

unload optch(i)

2、controls集合来添加控件
检查控件
dim on as contro
for each on in me.controls
on.enabled=true
next

private mop as optionbutton
private withevents mtxt as textbox '对事件进行响应
set mop=contros.add("vb.optionbutton","mopnew",fracolors)
mopnew.caption="new color"

set mtxt=controls.add("vb.textbox","mtxtname")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: