请问,请问,在改变Form的大小时,如何使Form上的其他控件也随着改变大小

请问,在改变Form的大小时,如何使Form上的其他控件也随着改变大小,谢谢!
[39 byte] By [tanjunrong123-ysj] at [2008-2-12]
# 1
1 自己写代码在runtime控件的width,height
2 用第3方控件。
extcsdn-StudingVBnow at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...
# 2
private sub form_resize()
dim ctl as control
on error resume next
for each ctl in controls
'下面这句根据你的实际需要更改。
ctl.move ctl.left,ctl.top,ctl.width*.1*scalewidth,ctl.width*.2*scaleheight
next
end sub
victorycyz- at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...
# 3
form的resize事件

Private Sub Form_Load()
Text1.Width = Form1.Width - 600
End Sub

Private Sub Form_Resize()
Text1.Width = Form1.Width - 600
End Sub
sotwind-醉风 at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...
# 4
在form的Resize事件中用代码,如果控件很多的话会很麻烦的
titan90-touchnet at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...
# 5
up.ok,good
artoksxb-进取人生 at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...
# 6
form_resize哦,我的一个软件光form_resize就有近300行。。。
kmzs-.:RNPA:.山水岿濛 at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...
# 7
有个控件的,留下地址,我发给你.
# 8
Dim a(), g(1) As Single
Dim t As Integer, dt As Integer

Private Sub Form_Activate()
If g(0) = 0 Then '原始值只記錄一次
g(0) = Form1.ScaleWidth: g(1) = Form1.ScaleHeight '一開始表單的大小
ReDim a(Form1.Controls.Count - 1, 5)
j = 0
For Each i In Form1.Controls '記錄每個物件的資料
a(j, 0) = i.Name
On Error Resume Next '避免某些物件沒有指定的屬性而錯誤
a(j, 1) = i.Left: a(j, 2) = i.Top
a(j, 3) = i.Width: a(j, 4) = i.Height
a(j, 5) = i.FontSize
On Error GoTo 0 '取消錯誤處理
j = j + 1
Next i
t = 0: dt = 100
End If
End Sub

Private Sub Form_Resize()
If Form1.WindowState <> 1 And g(0) > 0 And g(1) > 0 Then
'重算物件的新位置
For i = 0 To Form1.Controls.Count - 1
Set b = Controls(a(i, 0))
On Error Resume Next
b.Left = a(i, 1) / g(0) * Form1.ScaleWidth
b.Top = a(i, 2) / g(1) * Form1.ScaleHeight
b.Width = a(i, 3) / g(0) * Form1.ScaleWidth
b.Height = a(i, 4) / g(1) * Form1.ScaleHeight
If Form1.ScaleWidth / g(0) < Form1.ScaleHeight / g(1) Then
b.FontSize = a(i, 5) / g(0) * Form1.ScaleWidth
Else
b.FontSize = a(i, 5) / g(1) * Form1.ScaleHeight
End If
On Error GoTo 0

Set b = Nothing
Next i
End If
End Sub
daisy8675-莫依沉迷 at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...
# 9
参阅我的文档
http://www.Codefund.cn/Develop/read_article.asp?id=27195
Athoncj-阿龙 at 2007-10-21 > top of Msdn China Tech,visual basic,基础类...