?
Solved

TwipsPerPixel Question

Posted on 1998-12-17
5
Medium Priority
?
1,277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 400 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

Industry Leaders: 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

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…
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.
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…
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…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

741 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