Solved

TwipsPerPixel Question

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

911 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

21 Experts available now in Live!

Get 1:1 Help Now