vc CFont::CreateFont怎么设定字体间距?
1个回答
展开全部
使用SetTextCharacterExtra函数。
CFont font;
VERIFY(font.CreateFont(
36, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
TRUE, // bUnderline下划线标记,需要下划线把这里设置成TRUE
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
_T("Arial"))); // lpszFacename
// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.SetTextCharacterExtra(100);//设置字符间距
dc.TextOut(5, 5, _T("Hello,World!"), 5);
dc.SelectObject(def_font);
// Done with the font. Delete the font object.
font.DeleteObject();
CFont font;
VERIFY(font.CreateFont(
36, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
TRUE, // bUnderline下划线标记,需要下划线把这里设置成TRUE
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
_T("Arial"))); // lpszFacename
// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.SetTextCharacterExtra(100);//设置字符间距
dc.TextOut(5, 5, _T("Hello,World!"), 5);
dc.SelectObject(def_font);
// Done with the font. Delete the font object.
font.DeleteObject();
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询