Solved

Picture box that looks the same on any screen

Posted on 2001-08-13
7
167 Views
Last Modified: 2010-05-02
Hi,

I have a picture box that should be exactly 3.5" * 3.625 "
If I write the matching width and height in twips (5040*5220), what I see on the screen is MUCH larger than how it suppose to look like. Why does it happen? what should I do to force the screen to show the picture box in the "right" size? and how do I make sure that it will look the same on any monitor???

Thanks a lot!
0
Comment
Question by:meravkn
7 Comments
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6380507
Making sure that it will look the same on all monitors is really hard...but using twips surely won't help....normally I use pixels that gives reasonably accurate measures..

Max.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6380676
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6381092
I argue that it's impossible to auto-sense how big a control should be to create a predetemined size.

Because...although you MAY be able to detect a screen resolution. That's only part of the issue.

Aside from screen resolution, you have monitor sizes that differ in how much viewable area they have, and ...

Projector are really monitors and can accept output from your PC as though they are just monitors, and can be projected onto any surface at any distance.

How can you force a projector to display a window that's 3.5" on a wall that's 30 feet away?  Would you really want that?

--
Your best bet is to still use relative sizes for viewing purposes.  If you want to PRINT 3.5" that can usually be controlled because of the pritn parameters, but screen displays are never controlled to the point where you can detect every variation.
0
Independent Software Vendors: 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!

 
LVL 4

Expert Comment

by:mcoop
ID: 6382044
0
 
LVL 17

Accepted Solution

by:
inthedark earned 50 total points
ID: 6382646

If it is absolutely essential to have an object an exact physical size it can be done but not via software alone.

You have to use a calibration technique:

Step 1 display an object say six inches square. e.g. twips = 1440 * 6
(If you are happy with cm use a square of 15cm square e.g. 567*15

Step 2 measure the square using ruler and calculate the expansion/reduction  factor required to bring the image to the correct size.

Example calculation for a 15 cm square which was measured to be 15.5 cm wide and 14.5 cm heigh

intendedwidth=15
actualwidth=15.5
xfactor=(intendedwidth-(actualwidth-intendedwidth))/intendedwidth

also do the same for the height

intendedheight=15
actualheight=15.5
yfactor=(intendedheight-(actualheight-intendedheight))/intendedheight


Step 3 change your program so that whenever you set a height you multiply be the relevant factor.

e.g.

picture1.left=requiredleft*xfactor
picture1.width=requiredwidth*xfactor
picture1.height=requiredheight*yfactor
picture1.top=requiredtop*yfactor

If you are using any graphics methods you must also apply the factors to any coordinates.

If you are printing you need to apply sfactor, the smallest of either  xfactor or yfactor, to the font size.

example:

picture1.font.size=requiredsize*sfactor

Note: any graphics may be squishes or stretched a little.
p.s. avoid  3d picture boxes - make them flat

e.g. picture1.borderstyle=0
0
 
LVL 17

Expert Comment

by:inthedark
ID: 6382652
actualheight=14.5
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6384945
inthedark is correct, but even further...

To guarantee that something will be the exact size you want, you have to be in control of all aspects of the hardware.  You need to ensure that:

* it is not a projector (or if it is, it can detect the distance of the projection so you can calculate sizes);
* the monitor settings do not change (or if, for example, the horizontal size is changed, you can detect this and adjust the image size accordingly)
* the resolution doesn't change (or if it does, recalculate--this is easy because you get this from Windows)
* the monitor does not get replaced with a different model which prevents you from doing any of the above.

In other words, unless there's a really good reason to enforce a certain size, it's not going to be guaranteed because there are too many conditions out of the software's control.
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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 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