| 发表于:2008-01-19 10:40:35 楼主 |
请问如何随着窗体加载控件的增加而自动改变窗体尺寸? 我现在的程序是 private sub command4_click() load text1(text1.count) '装载一个新的控件 text1(text1.count - 1).top = text1(text1.count - 2).top + text1(text1.count - 2).height + 100 '设置新控件的位置 text1(text1.count - 1).visible = true '显示新控件最后,把这段代码放到合适的位置;当然,这里只是告诉你了一个最简单的添加方法,具体的还要根据你自己的实际要求来做相应处理,那也不过就是控件数量以及新控件的摆放位置了。希望对你有用 :) text1(text1.count - 1) = 0 '新增文本框请0 load text2(text2.count) '装载一个新的控件 text2(text2.count - 1).top = text2(text2.count - 2).top + text2(text2.count - 2).height + 100 '设置新控件的位置 text2(text2.count - 1).visible = true text2(text2.count - 1) = 0 '新增文本框请0 load command1(command1.count) '装载一个新的控件 command1(command1.count - 1).top = command1(command1.count - 2).top + command1(command1.count - 2).height + 100 '设置新控件的位置 command1(command1.count - 1).visible = true command1(command1.count - 1).caption = "计算" & format(command1.count, "00") if text1(text1.count - 1).top > form1.height - text1(text1.count - 1).height then form1.height = form1.height + text1(text1.count - 1) end if end sub private sub command2_click() if text1.count = 1 then exit sub unload text1(text1.count - 1) unload text2(text2.count - 1) unload command1(command1.count - 1) '装载一个新的控件 end sub 但随着控件数量增加超出了窗体,我想加条语句自动改变窗体尺寸 |
|
|
|
|