|
-
Nov 22nd, 1999, 06:27 AM
#1
Thread Starter
Lively Member
-
Nov 22nd, 1999, 06:32 AM
#2
Junior Member
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
-
Nov 22nd, 1999, 06:35 AM
#3
Hyperactive Member
There are 15 twips per pixel. And it DOES NOT change with screen size.
------------------
Ryan
[email protected]
ICQ# 47799046
-
Nov 22nd, 1999, 06:42 AM
#4
Junior Member
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).]
-
Nov 23rd, 1999, 04:37 AM
#5
Junior Member
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>>>>>>>>>>>>>>>>>>>>
-
Nov 23rd, 1999, 06:00 AM
#6
I believe LM Ginn is wrong, but if he cares to post an example I could become a believer.
------------------
Marty
-
Nov 23rd, 1999, 06:06 AM
#7
Junior Member
In the advanced settings of the display properties change the font size. When running large fonts the twips per pixel is 12.
------------------
LM Ginn
-
Nov 23rd, 1999, 09:25 AM
#8
Lively Member
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.
-
Nov 23rd, 1999, 12:05 PM
#9
Junior Member
Twips per pixel is dependant upon the size of the Windows screen fonts.
------------------
LM Ginn
-
Nov 23rd, 1999, 11:36 PM
#10
Junior Member
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).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|