Form Resize

I'm looking for generic VB code (I want to be able to use the code on almost any form if possible) that will resize and move all controls on a Form_Resize event.
Who is Participating?
VbmasterConnect With a Mentor Commented:
There is plenty of code samples on this topic at, just go to the Visual Basic area and search for Resize.
This example shows using a list view and a treeview on a form.

Define the vars in the on load event in the declarations section

in the on load event:

'some screen coordinates to allow resizing of controls when window is resized
lViewHeight = frame.ListView1.Height
lViewWidth = frame.ListView1.Width
lViewLeft = frame.ListView1.Left
tViewHeight = frame.TreeView1.Height
tViewWidth = frame.TreeView1.Width
frmWidth = frame.ScaleWidth
frmHeight = frame.ScaleHeight

in the resize event:

Dim scaleX As Single
Dim scaleY As Single

If frame.ScaleWidth > 0 Then
    scaleX = (frmWidth / frame.ScaleWidth)
    scaleX = 1
End If

If frame.ScaleHeight > 0 Then
    scaleY = frmHeight / frame.ScaleHeight
    scaleY = 1
End If

frame.ListView1.Move lViewLeft / scaleX, frame.ListView1.Top, lViewWidth / scaleX, lViewHeight / scaleY
frame.TreeView1.Move frame.TreeView1.Left, frame.TreeView1.Top, _
        tViewWidth / scaleX, (tViewHeight / scaleY)
jasonboetcherAuthor Commented:
Thanks for the quick response.
jasonboetcherAuthor Commented:
There were some great examples at that site.  The free form resize ocx available for download there works great.
Ya that site rules when you are lookin' for these kind of 'standardized' codes. ,)
All Courses

From novice to tech pro — start learning today.