this is how I do it. doesn't work with certain controls like comboboxes though it does work with listboxes.
Code:Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Dim WinBox As RECT, Ready As Boolean Private Sub Form_Load() Me.Show DoEvents GetClientRect Me.hwnd, WinBox Ready = True End Sub Private Sub Form_Resize() Dim c As Object Dim NewBox As RECT If Not Ready Then Exit Sub GetClientRect Me.hwnd, NewBox On Error Resume Next For Each c In Me.Controls Debug.Print c.Name c.Move c.Left * NewBox.Right / WinBox.Right, _ c.Top * NewBox.Bottom / WinBox.Bottom, _ c.Width * NewBox.Right / WinBox.Right, _ c.Height * NewBox.Bottom / WinBox.Bottom Next WinBox = NewBox End Sub




Reply With Quote
