Link to home
Start Free TrialLog in
Avatar of ChristianJ
ChristianJ

asked on

Objects to fit the form when resize

I want the objects to fit the form when I resize it. How do I do that? I'm working in VB 4
Avatar of ChristianJ
ChristianJ

ASKER

This will mean a lot to me. I have tried to solve this on my own for month, but I didn't make it.
Checkout elastic light from Videosoft:
www.videosoft.com
Edited text of question
Adjusted points to 75
I just want to know how to write to get the objects on a form to fit the form when i resize it. (VB 4)

Consider the hard way (the easy way is getting a control to do it for you):

In the form's load event, you need to keep track of every controls size and position in comparison to the form.  A percentheight, percentwidth, percentleft, and percenttop, if you will.  Then in the form's resize event, you will have to go through each control and re-adjust the size and location based on the new form's size multiplied by those percent* values for that control.
While this may sound easy for a few controls on a form, several controls can be unwieldy and dozens of controls virtually impossible.
For few controls in a form: (vp is a control)

Private Sub Form_Resize()
    Dim myScale!
    myScale! = ScaleHeight - 2 * vp.Top
    If myScale! > 0 Then vp.Height = myScale!
    myScale! = ScaleWidth - vp.Left - vp.Top
    If myScale! > 0 Then vp.Width = myScale!
    DoEvents
End Sub

I'm sorry the code you wrote didn't work.

Private Sub Form_Resize()
        Dim myScale!
        myScale! = ScaleHeight - 2 * vp.Top
        If myScale! > 0 Then vp.Height = myScale!
        myScale! = ScaleWidth - vp.Left - vp.Top
        If myScale! > 0 Then vp.Width = myScale!
        DoEvents
    End Sub


It appears a run-time-error '424' (myScale!) when I rum my program. Do I need to write anything else in the other procs?

In my project I have commadbuttons, dirlistbox, filelistbox, labels, imageScaler dirlistbox. Should i write anything in those objects to?
ASKER CERTIFIED SOLUTION
Avatar of CarlosJac
CarlosJac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial