[MFC]如何对齐垂直字符串? [英] MFC] How To align the vertical string?

查看:244
本文介绍了[MFC]如何对齐垂直字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。



我希望在矩形区域内正确显示垂直文本。

(水平对齐:中央,垂直对齐:顶部)



但是,如下所示,字母是在矩形区域外绘制的。



Hello.

I would like vertical text correctly and within the rectangular region.
(Horizontal alignment: central, vertical alignment: top)

However, as shown below, the letters were drawn outside the rectangle area.

LOGFONT lf;
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf);
lf.lfWeight = FW_SEMIBOLD;
lf.lfHeight = abs(m_nFontHeight);

CFont fonVert;
lf.lfEscapement = 900;
fonVert.CreateFontIndirect(&lf);

dc.SelectObject(&fonVert);
dc.DrawText("V Txt", -1, &rectToDraw, DT_TOP | DT_NOCLIP | DT_SINGLELINE | DT_CENTER);





我该怎么办?



请指教。

谢谢。



What should I do?

Please advise.
Thank you.

推荐答案

对于precice文本输出, CDC :: ExtTextOut 是一个更好的功能。



在这里你可以找到一些示例代码
For the precice text output the CDC::ExtTextOut is a better function.

Here you find some example code.


这篇关于[MFC]如何对齐垂直字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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