• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 595
  • Last Modified:

Best way to resize vb6 forms for different screen resoultions

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
JackVannoy
Asked:
JackVannoy
4 Solutions
 
d3nCommented:
Maybe the following link will help?

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

Regards, Dennis


0
 
SStoryCommented:
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
 
game-masterCommented:


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
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
SStoryCommented:
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
 
JackVannoyAuthor Commented:
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
 
JackVannoyAuthor Commented:
I want to cancel this because somehow I hit a wrong button.  I Do want to award points.  Don't know what happened
0
 
JackVannoyAuthor Commented:
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
 
SStoryCommented:
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
 
JackVannoyAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now