There are two parts to this code..
one is in the form itself and the other is in a module
Be Aware that this code will resize all the controls except a check box,combobox,listbox and your text size. However with a little manipulation I am sure you can write a routine for the text..if you do..let me know, I am still trying to do that.
put this code into the form you want to resize
************Start Form Code***************
Option Explicit
Private mintSaveWidth As Integer
Private mintSaveHeight As Integer
'additional vars for min and max
Dim intMinHeight As Integer, intMinWidth As Integer
Private Sub Form_Activate()
'Save Last height and width
mintSaveWidth = Me.Width
mintSaveHeight = Me.Height
End Sub
Private Sub Form_Load()
'Get the form min height and width
'Assume the programmer correctly sized the form initially
intMinHeight = Me.Height
intMinWidth = Me.Width
End Sub
Private Sub Form_Resize()
If (Me.Height >= intMinHeight) And (Me.Width >= intMinWidth) Then
ResizeControls Me, mintSaveWidth, mintSaveHeight
Else
'Force the form back to its last size
Me.Width = mintSaveWidth
Me.Height = mintSaveHeight
End If
End Sub
***************End Form Code*********************
then put this code into your module..then modify as you wish
**************Start Module Code******************
Option Explicit
Public Sub ResizeControls(frm As Form, oldWidth As Integer, _
oldHeight As Integer)
'Resize and readjust positions of all controls on the form
'Don't try to adjust minimized form.
If oldWidth < 1 Or oldHeight < 1 Then Exit Sub
Dim ratioW As Single, ratioH As Single
ratioW = frm.Width / oldWidth
ratioH = frm.Height / oldHeight
On Error Resume Next
Dim ctrl As Control
For Each ctrl In frm.Controls
With ctrl
.Width = .Width * ratioW
.Left = .Left * ratioW
.Height = .Height * ratioH
.Top = .Top * ratioH
End With
Next ctrl
oldWidth = frm.Width
oldHeight = frm.Height
End Sub
*****************End Module Code****************
zgtrman