Click to See Complete Forum and Search --> : *how many twips are in a pixel?, i need an excact amount
Bad5887
Nov 22nd, 1999, 05:27 AM
*
Ice
Nov 22nd, 1999, 05:32 AM
Dim DesignX As Integer
Dim DesignY As Integer
Dim Xtwips As Integer, Ytwips As Integer
Dim Xpixels As Integer, Ypixels As Integer
DesignX = 800
DesignY = 600
Xtwips = Screen.TwipsPerPixelX
Ytwips = Screen.TwipsPerPixelY
Ypixels = Screen.Height / Ytwips ' Y Pixel Resolution
Xpixels = Screen.Width / Xtwips ' X Pixel Resolution
Gimpster
Nov 22nd, 1999, 05:35 AM
There are 15 twips per pixel. And it DOES NOT change with screen size.
------------------
Ryan
corneslen@hotmail.com
ICQ# 47799046
Ice
Nov 22nd, 1999, 05:42 AM
thats what i said, just a little code came a long with the copy/paste.
[ Screen.TwipsPerPixelX ]
[ Screen.TwipsPerPixelY ]
Gimpster, you want to repremand me for giving the answer in a useful example. What happens in two months or when some one else reads the code? The MAGIC NUMBER 15 pops up. Where as the way I have done it; the answer is easily seen without any rem statements.
[This message has been edited by Ice (edited 11-22-1999).]
Ice
Nov 23rd, 1999, 03:37 AM
from help
-----------------------------
TwipsPerPixelX, TwipsPerPixelY Properties
Return the number of twips per pixel for an object measured horizontally (TwipsPerPixelX) or vertically (TwipsPerPixelY).
Syntax
object.TwipsPerPixelX
object.TwipsPerPixelY
-----------------------------
since the object is the screen, what is returned is the number of twips per pixel for the screen measured horizontally and verticly.
I see no mention of fonts.
if however, that were the case, by changing fonts and sized, one should get numbers different from 15.
Strange though, I did not. Here is the code I used. May be I did something wrong.
<<<<<<<<<<<<<<<<<<code>>>>>>>>>>>>>>>>>>>>>>
Option Explicit
Private Sub Form_Load()
Dim x 'x
Dim y 'y
Dim f() 'dynamic array for fonts
Dim fi 'counter for fonts
Dim i 'counter for loop
ReDim f(0 To 10)
fi = 10 'set font counter to max in array
Me.AutoRedraw = True
For i = 0 To Screen.FontCount - 1
If i >= fi Then
ReDim Preserve f(i)
End If
f(i) = Screen.Fonts(i)
With Me.Font
.Name = f(i)
'increase font size by 1
If i = 0 Then
.Size = 1
Else
.Size = i
End If
End With
x = Screen.TwipsPerPixelX
y = Screen.TwipsPerPixelY
PrintSomething x, y
Next i
End Sub
Private Sub PrintSomething(x, y)
'print twips per pixel in the screen font
'and in the size designated
Me.Print "x: " & x & " y: " & y
End Sub
<<<<<<<<<<<<<<<<end code>>>>>>>>>>>>>>>>>>>>
MartinLiss
Nov 23rd, 1999, 05:00 AM
I believe LM Ginn is wrong, but if he cares to post an example I could become a believer.
------------------
Marty
LM Ginn
Nov 23rd, 1999, 05:06 AM
In the advanced settings of the display properties change the font size. When running large fonts the twips per pixel is 12.
------------------
LM Ginn
SteveS
Nov 23rd, 1999, 08:25 AM
1 way of finding out the Twips/Pixel is
[ Screen.TwipsPerPixelX ]
[ Screen.TwipsPerPixelY ]
as ICE correctly pointed out.
The Twips/Pixel changes depending on screen resolution NOT font size.
There are always 12000 X 9000 Twips on a screen.
Therefore at a resolution of 800 X 600 there are always
12000/800 = 15 Twips/Pixel
or
9000/600 = 15 Twips/Pixel
Work out the resolution you are working at and see that at different resolutions there are different numbers of Twips/Pixel.
Hope this helps,
Steve.
LM Ginn
Nov 23rd, 1999, 11:05 AM
Twips per pixel is dependant upon the size of the Windows screen fonts.
------------------
LM Ginn
LM Ginn
Nov 23rd, 1999, 10:36 PM
Did I misunderstand the question or am I doing something wrong?
At 800 X 600 resolution using the Small Font Set(96 dpi) Screen.TwipsPerPixelX returns 15.
At 1280 X 1024 resolution using the Small Font Set(96 dpi) Screen.TwipsPerPixelX returns 15.
At 800 X 600 resolution using the Large Font Set(120 dpi) Screen.TwipsPerPixelX returns 12.
At 1280 X 1024 resolution using the Large Font Set(120 dpi) Screen.TwipsPerPixelX returns 12.
Does anyone else get these results?
------------------
LM Ginn
[This message has been edited by LM Ginn (edited 11-24-1999).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.