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.
Printable View
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.
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.