CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    10

    Converting twip?

    I know a twip is 1/20 of a point but what is a twip to a pixel? and a point
    to a pixel conversion?

    Thanks


  2. #2
    Join Date
    Apr 1999
    Location
    Rotterdam, Netherlands
    Posts
    278

    Re: Converting twip?

    Check out the Screen.TwipsPerPixelX Screen.TwipsPerPixelY.


  3. #3
    Join Date
    Apr 1999
    Posts
    45

    Re: Converting twip?

    Why not set the Scale property on your form to pixels instead of twips.

    Gordito


  4. #4
    Join Date
    Mar 2000
    Posts
    1

    Re: Converting twip?

    For VC++ programmers, take a look at: http://support.microsoft.com/support.../Q196/8/33.ASP

    Here are some snippets of code copied from above. You may also need to use MapDialogRect() or GetDialogBaseUnits().



    int m_nLogX;
    int m_nLogY;

    // To convert grid rect from twips to DC units you need
    // pixels per inch.
    CDC* pDC = GetDC();
    m_nLogX = pDC->GetDeviceCaps(LOGPIXELSX);
    m_nLogY = pDC->GetDeviceCaps(LOGPIXELSY);
    ReleaseDC(pDC);

    // Create invisible edit control.
    m_edit.Create(WS_CHILD|ES_MULTILINE|ES_WANTRETURN,
    CRect(0,0,0,0), this, GetDlgCtrlID());

    // Adjust for border height and convert from twips to screen
    // units.
    m_edit.MoveWindow(((GetCellLeft() - m_lBorderWidth) *
    m_nLogX)/1440,
    ((GetCellTop() - m_lBorderHeight) * m_nLogY)/1440,
    (GetCellWidth()* m_nLogX)/1440,
    (GetCellHeight()* m_nLogY)/1440, FALSE);
    m_edit.ShowWindow(SW_SHOW);
    m_edit.SetFocus();








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

Featured