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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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)
There is plenty of code samples on this topic at, just go to the Visual Basic area and search for Resize.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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. ,)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.