如何让VB中的所有控件随窗体一起放大
如何让VB中的所有控件随窗体一起放大
'声明变量
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
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
试试吧