> How do I translate  inches in to pixel measurement ?
> For instances 3 1/2 x 2inches = h&w in pixels ?

On a Mac, you have Quartz Display Services to declare to. I think this will
do what you want.

Define in a module CGSize, width As Single, height As Single
Create a pushbutton and place this code, create an editfield too.
  
  Soft Declare Sub CGDisplayScreenSize Lib "ApplicationServices.framework"
(ByRef aCGSize As CGSize, display As Integer)
  Soft Declare Function CGMainDisplayID Lib "ApplicationServices.framework"
() As Integer
  Dim myDisplay As Integer
  myDisplay = CGMainDisplayID()
  Dim myCGSize As CGSize
  CGDisplayScreenSize(myCGSize, myDisplay)
  EditField1.AppendText "Width: " + Str(myCGSize.width) + " mm." +
EndOfLine
  EditField1.AppendText"Height: " + Str(myCGSize.height) + " mm." +
EndOfLine
  EditField1.AppendText "Width: " + Str(myCGSize.width/25.4) + " inches." +
EndOfLine
  EditField1.AppendText"Height: " + Str(myCGSize.height/25.4) + " inches." +
EndOfLine
  
  Soft Declare Function CGDisplayPixelsHigh Lib
"ApplicationServices.framework" (display As  Integer) As Integer
  Soft Declare Function CGDisplayPixelsWide Lib
"ApplicationServices.framework" (display As  Integer) As Integer
  Dim myDisplayWidth, myDisplayHeight As Integer
  myDisplayWidth = CGDisplayPixelsWide(myDisplay)
  myDisplayHeight = CGDisplayPixelsHigh(myDisplay)
  EditField1.AppendText "Resolution Width: " + Str(myDisplayWidth) +
EndOfLine
  EditField1.AppendText "Resolution Height: " + Str(myDisplayHeight) +
EndOfLine
  EditField1.AppendText "Pixels Per Inch - Width: " + Str(myDisplayWidth/
(myCGSize.width/25.4)) + EndOfLine
  EditField1.AppendText "Pixels Per Inch - Height: " + Str(myDisplayHeight/
(myCGSize.height/25.4)) + EndOfLine
  EditField1.AppendText "3.5 by 2 inches is: " + Str(3.5 *  (myDisplayWidth/
myCGSize.width/25.4) + 2 * (myDisplayHeight/ (myCGSize.height/25.4))) + "
pixels."
  

I have an encrypted module for this CGDisplay framework, if anyone is
interested, drop me a line.

--
Thomas C.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to