Announcement

Collapse
No announcement yet.

SETMAPMODE(HDC, %MM_TWIPS)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SETMAPMODE(HDC, %MM_TWIPS)

    Gentlemen

    I work with VB / PBDLL 6.0

    I want to use a Picture Box of VB to make a graph in PBDLL.

    but I am having problems when making the conversion of
    having COORDINATED OF DEVICE for LOGICAL COORDINATE %MM_TWIPS.

    this it is part of the code.

    hDC = getDc(hWnd&)
    oldDC = SAVEDC(hDC)
    IF SETMAPMODE(HDC, %MM_ANISOTROPIC) = 0 THEN GOTO ROUTINE_OF_ ERROR
    I wander = GetLastError ()
    IF wander <>0 THEN GOTO ROUTINE_OF_ERROR
    CALL SETWINDOWEXTEX (HDC ,14000, 7000 ,BYVAL %NULL) '
    CALL SETVIEWPORTEXTEX (HDC ,14000,7000,BYVAL %NULL) '
    CALL SETWINDOWORGEX (HDC ,0,0,BYVAL %NULL)

    certainly, thank you

    Amauri


    ------------------

  • #2
    You call PB from VB with Picture1.hWnd as parameter.
    In PB - GetClientRect hWnd, rc (pixels).
    Where twips ?

    ------------------
    E-MAIL: [email protected]

    Comment


    • #3
      Amauri;

      SETWINDOWEXTEX and SETVIEWPORTEXTEX don't get the same values.

      SETVIEWPORTEXTEX is used to set the "actual" size of the viewport
      in this the case the size of the Printers Page in Pixels
      (printer Units/dots). This can be returned using GetDeviceCaps.

      SETWINDOWEXTEX is used to "scale" the Viewport. It determines how many
      real pixels/dots are in a Logical Unit.

      If I set the Viewport (SETVIEWPORTEXTEX)to say 2400 x 3000 (8" x 10" at 300 DPI)
      Printer Units/Pixels/Dots and then I want to convert to Twips, then I
      would use (SETWINDOWEXTEX) 11520 x 14400 (8" (times 1440/inch) x 10" (times 1440/inch)
      to define the window.

      You must know the size of the Printers Page using GetDeviceCaps before
      you can make the conversion.

      SETWINDOWEXTEX must always be called before SETVIEWPORTEXTEX !

      The originals of both the Window and Viewport are 0,0 when a DC is
      created, but it doesn't hurt to set them anyway just to make sure
      they are correct.


      ------------------


      [This message has been edited by Chris Boss (edited February 26, 2001).]
      Chris Boss
      Computer Workshop
      Developer of "EZGUI"
      http://cwsof.com
      http://twitter.com/EZGUIProGuy

      Comment


      • #4
        Dear Semen, Chris

        I thank them for their help.

        they left me clear with my doubt.

        regards

        amauri

        ------------------

        Comment

        Working...
        X