以textbox为例,先创建控件数组text1(index),至少要有一个text1(0),然后
load(text1(1))
text1(1).width=text1(0).width
text1(1).height=text1(1).height
text1(1).left=text1(0).left
text1(1).top=text1(0).top+text1(0).height+50
if text1(1).top+text1(1).height>=form1.height then
'调整text1(1)的高度使之能够呆在窗体里面
end if
if text1(1).left+text1(1).width>=form1.width then
' 调整text1(1)的宽度使之能够呆在窗体里面
end if
text1(1). visible =true
说了这么多就是告诉你在显示之前一定要确保新控件的位置不会被什么东西盖住或者跑到窗体之外,窗体是控件的容器,出了窗体什么控件都是看不到的。
温馨提示:答案为网友推荐,仅供参考