Solved

TwipsPerPixel Question

Posted on 1998-12-17
5
1,238 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now