?
Solved

Objects to fit the form when resize

Posted on 1998-09-14
10
Medium Priority
?
231 Views
Last Modified: 2012-05-04
I want the objects to fit the form when I resize it. How do I do that? I'm working in VB 4
0
Comment
Question by:ChristianJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
10 Comments
 

Author Comment

by:ChristianJ
ID: 1434758
This will mean a lot to me. I have tried to solve this on my own for month, but I didn't make it.
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1434759
Checkout elastic light from Videosoft:
www.videosoft.com
0
 

Author Comment

by:ChristianJ
ID: 1434760
Edited text of question
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:ChristianJ
ID: 1434761
Adjusted points to 75
0
 

Author Comment

by:ChristianJ
ID: 1434762
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)

0
 
LVL 6

Expert Comment

by:clifABB
ID: 1434763
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.
0
 
LVL 1

Expert Comment

by:CarlosJac
ID: 1434764
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

0
 

Author Comment

by:ChristianJ
ID: 1434765
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?

0
 

Author Comment

by:ChristianJ
ID: 1434766
In my project I have commadbuttons, dirlistbox, filelistbox, labels, imageScaler dirlistbox. Should i write anything in those objects to?
0
 
LVL 1

Accepted Solution

by:
CarlosJac earned 140 total points
ID: 1434767
Try this:

Private Sub Form_Resize()
        Dim myScale As Single
        vp.Top = 0
        vp.Left = 0
        myScale = ScaleHeight - 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
 
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 18 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question