在onpaint里面:
else
{
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
lf.lfHeight = 13; // request a 12-pixel-height font
strcpy(lf.lfFaceName, "宋体"); // request a face name "Arial"
lf.lfEscapement = 2700;
VERIFY(font.CreateFontIndirect(&lf)); // create the font
// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.SetBkMode(TRANSPARENT);
dc.TextOut(20, 20, "旋转");
dc.SelectObject(def_font);
// Done with the font. Delete the font object.
font.DeleteObject();
//
CDialog::OnPaint();
}
本文介绍如何使用C++及Windows GDI API创建一个旋转显示的文本。通过具体代码示例,展示了设置字体属性、创建字体对象、选择设备上下文环境、设置背景模式并输出文本的过程。
1553

被折叠的 条评论
为什么被折叠?



