自行设置了字体
ZeroMemory(&m_logFont,sizeof(m_logFont));
lstrcpy(m_logFont.lfFaceName,_T("黑体"));
m_logFont.lfHeight = - abs( CUIManager::GetValue(_T("HideItem"),_T("FontSize"), 25) );
m_logFont.lfWeight = FW_BLACK;
m_logFont.lfWidth=0;
m_logFont.lfItalic=FALSE;
m_logFont.lfOrientation=0;
m_logFont.lfEscapement=0;
m_logFont.lfUnderline=FALSE;
m_logFont.lfStrikeOut=FALSE;
m_logFont.lfCharSet=ANSI_CHARSET;
m_logFont.lfOutPrecision=OUT_DEFAULT_PRECIS;
m_logFont.lfClipPrecision=CLIP_DEFAULT_PRECIS;
m_logFont.lfQuality=DEFAULT_QUALITY;
m_logFont.lfPitchAndFamily=FF_MODERN|DEFAULT_PITCH;
m_font.CreateFontIndirect(&m_logFont);
memDC.DrawText(sText,gripper,DT_CENTER|DT_VCENTER|DT_SINGLELINE);输出乱码
排除字体转换问题,发现黑体改为宋体即可。
lstrcpy(m_logFont.lfFaceName,_T("宋体"));
原因:系统缺乏黑体,造成中文乱码。当必须改字体时,自己安装上即可。