Click to See Complete Forum and Search --> : how can I underline, bold and italics a word in a SDI child area


Erich Ruth
May 14th, 1999, 04:32 PM
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.

May 14th, 1999, 04:59 PM
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).