Dim OldW
As Single
Dim OldH
As Single
'窗口大小发生改变时
Private Sub Form_Resize()
On Error Resume Next
'最小大小,防止比例失调
If Me.Width < 4800 Then Me.Width = 4800
If Me.Height < 3600 Then
Me.Height = 3600
Exit Sub
End If
Dim cu As Control
For Each cu In Me.Controls
'调整大小
cu.Move cu.Left * Me.Width / OldW, cu.Top * Me.Height / OldH, cu.Width * Me.Width / OldW, cu.Height * Me.Height / OldH
Next
'赋值
OldW = Me.Width
OldH = Me.Height
End Sub
OldW = Me.Width
OldH = Me.Height
End Sub