?
Solved

Resizing All Controls in VB6

Posted on 2007-10-09
3
Medium Priority
?
182 Views
Last Modified: 2013-12-26
I need a loop for resizing everything on the form. Someone else had a similar idea
(See: http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_10119528.html)
The answer wasn't what I was looking for, I figure it may be better to start from scratch...
This is the best solution I could find:
(See: http://www.vb-helper.com/howto_stretch_controls.html
This sort of loop was close to what I was looking for, but ...blah blah blah, I need something else

I have maxed out the control limit on this form/project, which is why I need a loop.

The reason for the resize in that I made a program in 1280 x 1024, and as I said before There's so many controls that it's one away from maxing out the limit on the cotrols. Program is complete, except for this.

Please put some thought in this, I have...for months, last hope
0
Comment
Question by:PME_Inc
  • 3
3 Comments
 
LVL 23

Accepted Solution

by:
ahammar earned 2000 total points
ID: 20046072
If I understand you right, you just want to resize all your controls so they will all fit on your form??
This will increase or decrease all your forms controls, and reposition them to match:

Put this sub in your form:

Private Sub AdjustControls(ByVal value As Single)
    On Error Resume Next
   
    Dim c As Control
    Dim aa As Integer
    Dim temp
   
    For Each c In Me.Controls
            c.Left = c.Left * value
            c.Top = c.Top * value
            c.Width = c.Width * value
            c.Height = c.Height * value
    Next
End Sub


Then call it like this:
      AdjustControls 0.5
That will half the size of each control

If you change the 0.5 to a 2, then all the controls sizes will double, so as you can see, you can put any number in there you want.  So if you put say...0.9, then they would decrease in size slightly, or 1.1 and they would increase slightly.

All the controls will reposition themselves to where they need to be also...

:-)
ah


0
 
LVL 23

Assisted Solution

by:ahammar
ahammar earned 2000 total points
ID: 20046078
Oh...Remove these 2 lines:
    Dim aa As Integer
    Dim temp
   
You don't need those.  I just cut this code snippit out of another app I wrote awhile back and forgot to take those 2 lines out...

:-)
ah
0
 
LVL 23

Expert Comment

by:ahammar
ID: 20046209
Thanks for the points and the grade!...I hope that simple bit of code did a good job for you...

:-)
ah
0

Featured Post

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.

Question has a verified solution.

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

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

840 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