Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

TwipsPerPixel Question

Posted on 1998-12-17
5
Medium Priority
?
1,290 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 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…
Suggested Courses

604 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