CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    Miami, Florida
    Posts
    242

    how can I underline, bold and italics a word in a SDI child area

    To print text to the SDI child area, I typed;

    OnDraw()
    {
    CFont newFont;
    newFont.CreatePointFont(100, "Times New Roman");
    CFont *pOldFont = pDC->SelectObject(&newFont);

    pDC->TextOut(5, 5, "Text to screen");

    pDC->SelectObject(pOldFont);
    newFont.DeleteObject();
    }

    How can I adjust this code so that a word is underlined, in bold,
    italics, or all of the above?

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



  2. #2
    Guest

    Re: how can I underline, bold and italics a word in a SDI child area

    use createfont instead of createpointfont:

    BOOL CreateFont( int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename );

    You then can set flags for italic and underline, and the font weight for bold (FW_BOLD).


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