Solved

TwipsPerPixel Question

Posted on 1998-12-17
5
1,251 Views
Last Modified: 2012-06-27
I really don't understand that why the Screen.TwipsPerPixelX value is always a constant and Screen.TwipsPerPixelY is O when I moved the mouse to the SystemTray icon. No matter how I changed the resolution, the values haven't changed. I have no concept about it. Also, what is the different between ppi and dpi, any relationship? Moreover, How many pixels represent 1 physical inch? The value will varies with the screen resolution? VB6 has any function to convert between twips, points, pixels and Inches??

Thanks in advance    
0
Comment
Question by:Torus
5 Comments
 
LVL 1

Expert Comment

by:OeilNoir
ID: 1450913
Screen size and resolution will affect the number of pixels per inch.
Exemple : if you have a 14 inch monitor and you set your screen in 800X600, you will
have a height of 800 pixel.. if you change it  to 640X480, you will have a height of 480 and your monitor size haven't changed. only the number of pixel changed.

There is about 1440 Twips per inch
There is about 72 points per inch
15 twpis = 1 pixel
(see "ScaleMode" in your VB help)

i think the reason why TwipsPerPixelY is always 0 when you move over the System Tray icon, is because you wrote the code somewhere in mouse_move.. and since you move
outside your form it can't tell the value..

what are you trying to do exactly?

0
 
LVL 15

Expert Comment

by:ameba
ID: 1450914
Try setting 'Large Font'. Screen.TwipsPerPixelY will change.
0
 
LVL 2

Author Comment

by:Torus
ID: 1450915
Actually I just want to calculate the actually printer size of a picture via twips or pixels.
Also I have no concept about what they are and I want to know more about it.

As you said, 15twips = 1 pixels. Is it a constant no matter what resolution. If so, I don't understand that if 1440 twips per inch, the number of  pixels per inch should have no change even resolution is changed?
Also what is different between ppi and dpi? What does point mean? How many pixels
represent one point?

Thanks in advance


0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1450916
As OeilNiel pointed out. There are 1440 twips per inch. There are 72 points per inch. These are constants and never change.

However, different devices will have different pixels (or dot) per inch. The numbers vary because of the technology behind it. For example, a laser printer could have 300 pixels per inch while an older dot matrix printer could have 72 pixels per inch. The screen is completely different in that the number of pixels per inch can vary greatly because of screen resolution (640 pixels across) and monitor size (13", 15", 40", etc.).

Basically, twips and points are logical units of measurements. They can be thought of as device-independent, they are universally true. But when you talk about pixels per inch, you are talking about a particular device with a particular setting.

To determine how many pixels represent one point, let's assume we are talking about a 300 dpi laser printer.

In one inch, there are 300 pixels and 72 points:

   300 pixels    72 points
   ----------  = ---------
      1 inch       1 inch

Therefore 72 logical points is equal to 300 laser-printer pixels.
So 1 logical point is 300/72 pixels = 4.1666... pixels.

When you are dealing with twips, the underlying VB architecture takes into consideration of screen resolution to convert it to the proper number of screen pixels. This happens automatically and your program should be taken advantage of it.
0
 
LVL 1

Expert Comment

by:Shyam121498
ID: 1450917
I don't have much idea about the units.  But you can convert from one to another usin ScaleX and ScaleY functions.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

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