CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    May 2002
    Location
    France, Toulouse
    Posts
    156

    DrawText, Scale and world transformation

    Hi

    I want to scale a text using GDI DrawTextEx Function, so I do the folowing;

    Code:
    UINT uFormat = DT_WORDBREAK;
    
    pDC->SetGraphicsMode(GM_ADVANCED);
    pDC->SetMapMode(MM_TEXT);
    
    pDC->DrawTextEx(sText,rcDest,uFormat,NULL); //Draw the text at its initial size
    
    XFORM xForm;
    xForm.eM11 = 2.0; //scale by 2.0
    xForm.eM12 = 0.0;
    xForm.eM21 = 0.0;
    xForm.eM22 = 2.0; //scale by 2.0
    xForm.eDx = 0.0;
    xForm.eDy = 0.0;
    
    pDC->ModifyWorldTransform(&xForm,MWT_LEFTMULTIPLY);
    
    pDC->DrawTextEx(sText,rcDest,uFormat,NULL); //Draw the scaled text
    the text is well scaled, but has a little difference with the original text, sometimes the scaled text does not fit in the rectangle, and some times when the original text is on 2 lines the scaled one is on one line?

    what am I doing wrong?

    thank you
    Last edited by khaldoun KASSEM; October 17th, 2006 at 01:27 PM.

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