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

Thread: different fonts

  1. #1
    Join Date
    May 1999
    Posts
    327

    different fonts


    How can I print text to an mdi child in a different font? I would love to print text in say times roman with bold, or italics, or underlined.

    Any response any one can give me will be greatly appreciated.


  2. #2
    Guest

    Re: different fonts

    In your view's OnDraw function, do the following:

    CFont MyFont;
    MyFont.CreatePointFont(12, "Arial" ); // for 12pt Arial

    pOldFont = pDC->SelectObject(&MyFont);

    pDC->TextOut(x, y, "Hello");

    pDC->SelectObject(pOldFont);
    MyFont.DeleteObject();


    CreatePointFont is the easiet way to create a font. If you want italics, bold, etc. check the documentation for CreateFont and CreateFontIndirect under CFont.

    Good Luck.



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