简体   繁体   中英

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!

我相信您需要创建一个新的CFont因为创建后没有成员可以对其进行修改,而且我不知道有任何Win32函数可以在包含的HFONT句柄上进行此HFONT

您必须创建一个新字体。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM