JavaScript Warrior
JavaScript Warrior

Reputation: 763

GDI Modify Font in MFC

I have a MFC application that uses GDI for drawing.

When I want to draw out some text I make a new font and call TextOut method on the device context:

CFont font;
font.CreateFontW(20,0,-100,0,0,0,0,0,0,0,0,0,0,CString("Arial"));
CFont *oldfont = ctx->SelectObject(&font);

ctx->TextOutW(50, 50, CString("123"));

And that works great. Now I want to change the font a little bit (adjust the escapement). Can I do that with existing font, or do I have to make a new CFont?

Thanks!

Upvotes: 1

Views: 852

Answers (2)

xMRi
xMRi

Reputation: 15355

You have to create a new font.

Upvotes: 0

Dave Rager
Dave Rager

Reputation: 8150

I believe you need to create a new CFont as there are no members for modifying it after it has been created and I'm not aware of any Win32 functions that can do that on the contained HFONT handle.

Upvotes: 2

Related Questions