处理动态CFonts的最佳方法 [英] Best way to deal with dynamic CFonts

查看:82
本文介绍了处理动态CFonts的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试找出处理动态CFonts的最佳方法,例如.每次调用Draw()函数时,它们都会在初始化时采用不同的参数.

当前我所拥有的是将CFont存储为成员变量,并在构造时对其进行初始化.

如果用户要更改文本大小或方向,我将调用以下代码系列.

Hi all,

I''m trying to figure out what is the best way of dealing with dynamic CFonts, eg. They take on different parameters on initialization everytime the Draw() function is called.

Currently what I have is that I store the CFont as a member variable and initialize it on construction.

If the user were to change the text size or orientation, I call the following series of codes.

m_iTextSize = newSize;
m_dOrientation = newOrientation;

m_DrawFont.DeleteObject();
m_DrawFont.CreateObject(m_iTextSize,
0,
m_dOrientation * 10,
0,
FW_NORMAL,
FALSE,
FALSE,
0,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS,
"Arial");



当我必须打印出消息时,我会调用以下代码.



And when I have to print out the message, I call the following series of codes.

CDC * pDC = GetDC();
CFont * pOldFont = pDC->SelectObject(&m_DrawFont);
pDC->TextOut(locationX, locationY, m_Text);
...



如果在Draw()函数中实例化本地CFont会更好吗?



Would it be better if I were if I instantiate a local CFont inside my Draw() function?

推荐答案

我相信您正在做的事是一种很好的方法完成它.
I believe what you''re doing is a good way to get it done.


这篇关于处理动态CFonts的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆