Solved

Picture box that looks the same on any screen

Posted on 2001-08-13
7
166 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

790 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