Click to See Complete Forum and Search --> : different fonts


Danielle Harvey
April 3rd, 1999, 09:52 PM
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.

April 5th, 1999, 10:57 AM
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.