Results 1 to 10 of 10

Thread: *how many twips are in a pixel?, i need an excact amount

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    64

    Post

    *

  2. #2
    Junior Member
    Join Date
    Oct 1999
    Posts
    16

    Post

    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

  3. #3
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    There are 15 twips per pixel. And it DOES NOT change with screen size.

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

  4. #4
    Junior Member
    Join Date
    Oct 1999
    Posts
    16

    Post

    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).]

  5. #5
    Junior Member
    Join Date
    Oct 1999
    Posts
    16

    Post

    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>>>>>>>>>>>>>>>>>>>>


  6. #6
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    I believe LM Ginn is wrong, but if he cares to post an example I could become a believer.

    ------------------
    Marty

  7. #7
    Junior Member
    Join Date
    Sep 1999
    Posts
    19

    Post

    In the advanced settings of the display properties change the font size. When running large fonts the twips per pixel is 12.


    ------------------
    LM Ginn


  8. #8
    Lively Member
    Join Date
    Jun 1999
    Location
    Ireland
    Posts
    96

    Post

    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.

  9. #9
    Junior Member
    Join Date
    Sep 1999
    Posts
    19

    Post

    Twips per pixel is dependant upon the size of the Windows screen fonts.



    ------------------
    LM Ginn


  10. #10
    Junior Member
    Join Date
    Sep 1999
    Posts
    19

    Post

    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
  •  



Click Here to Expand Forum to Full Width