[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Best way to resize vb6 forms for different screen resoultions

Posted on 2008-11-11
10
Medium Priority
?
588 Views
Last Modified: 2012-05-05
Have a VB6 project that contains multiple forms.  It was originally designed using 800X600 resoulition. We need to be able to accomodate for the various higher settings now available.
0
Comment
Question by:JackVannoy
9 Comments
 
LVL 1

Accepted Solution

by:
d3n earned 500 total points
ID: 22933035
Maybe the following link will help?

http://www.vb-helper.com/tutorial_sizing_forms.html

Regards, Dennis


0
 
LVL 25

Assisted Solution

by:SStory
SStory earned 1000 total points
ID: 22933076
componentone.com sells an ActiveX suite that includes:
http://componentone.com/SuperProducts/SizerOne/

Back in the day there were several sizer controls that you just dropped items into. I think Infragistics also has one.  Or you can do it yourself by proportionally calculating the width/height and position of every single control from the start and on resize event. The problem is Font sizing and image stretching.
0
 
LVL 13

Assisted Solution

by:game-master
game-master earned 500 total points
ID: 22936064


good morning!

this is a sample code...and i think it can give u idea..

Me.Width = Screen.Width
Me.Height = Screen.Height

using this code, the form size will vary depending on the resolution of the
computer. Now that u know the size of your Main Form, it is up to you
set size on your other forms.

game-master
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 25

Assisted Solution

by:SStory
SStory earned 1000 total points
ID: 22939638
VB.NET has panel controls and the ability to dock and anchor.  You could probably write the same thing in VB6 if you know how to write controls.  You could, for example, make a usercontrol and place the Picturebox control in it as a constituent control.  Set it's size always to the entire size of the UserControl itself.  Then when the resize event is called for that control, or by some public Sub in the control, you could resize it based upon the size of the container and some sort of percentages or something.  Whenever anyone added a control inside the Picturebox control--the one in your UserControl--which I think can contain other controls--you could record the size of that control relative to the size of the picturebox and any time that the picturebox was stretched, you could reposition, resize all controls inside of it.

This would all be a lot of work, mind you, but it can be done.

A less sophisticated way would be, everytime that the form resizes you set position and height/width of all controls on it based upon some percentage.

So if txtName.Width=50 when the form width is 500, and
txtName.Height=20 when the form height is 200 then txtName.tag could have been set to ".1,.1" because it is .1 the width of the form and it is .1 is the height of the form.  Then on each form resize you'd parse that value to split them up and set txtName.width=me.width * .1

This would help you set height and width. Unfortunately you'd also want to keep the relative position between all controls so you'd have to implement that in some way also.  One potential way to do this is:
Make a control that is visible at design time that can be set to horizonal or vertical orientation.  At runtime it would be invisible.  Put these controls between items horizontally and vertically.  the control, if horizontal would have a reference to the control to the left of it and right of it.  When the form was resized it would also be resized percentagewise and the key is that it would always have its left side touching the right side of the control to the left of it and then it would move the control to its right by setting the control to the right's left property to 1 pixel past its right side.  I have seen controls that already do this for sale back in the late 90's when I was in vb6.  Do it vertically would be similar.
Anyway you stack it, it is a lot of work.

Obviously, buying premade controls is the easiest way.  It may not be the cheapest, unless your time is worth a lot and then it would definitely be better/cheaper to buy premade/pretested/proven controls to handle it.
0
 

Author Comment

by:JackVannoy
ID: 23001070
Thanks to everyone who has responded to my question.  I am in the process of evaluating the responses, and trying the different approches. I will get back within the next couple of days with my results, and award the points.

Jack
0
 

Author Comment

by:JackVannoy
ID: 23026084
I want to cancel this because somehow I hit a wrong button.  I Do want to award points.  Don't know what happened
0
 

Author Comment

by:JackVannoy
ID: 23026095
I have got myself very confused.  I want to make sure that each of the four who responded to my question each get 125 points.  Would someone please advise me if somehow this is NOT what I accomplished.

Thanks
0
 
LVL 25

Expert Comment

by:SStory
ID: 23031103
He is asking for a point split. I only object to closing if it means no points..which is not what he has stated he wants to do.
0
 

Author Closing Comment

by:JackVannoy
ID: 31515619
Thanks again for all of the help.  Sorry I got the first part of the close wrong.  Will try to be more accruate next time.

Jack
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

830 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