第七章4.txt
来自「本书在复习C++基础知识后」· 文本 代码 · 共 24 行
TXT
24 行
void CEx_A7View::DrawInfoWnd(CDC *pDC, CPoint pt, CString strInfo)
{
CRect rcWnd( pt.x, pt.y - 15, pt.x + 80, pt.y );
pDC->FillSolidRect( rcWnd, RGB( 0, 0, 128 ) );
pDC->Draw3dRect( rcWnd, RGB(255,255,255), RGB(255,255,255) );
// 定义并设置文本字体
LOGFONT lfText;
memset(&lfText, 0, sizeof(LOGFONT));
lfText.lfHeight = -12;
lfText.lfCharSet = GB2312_CHARSET;
strcpy(lfText.lfFaceName, "宋体");
CFont cf;
cf.CreateFontIndirect(&lfText);
CFont *oldFont = pDC->SelectObject( &cf );
pDC->SetBkColor( RGB( 0, 0, 128 ) );
pDC->SetTextColor( RGB( 192, 192, 0 ) );
pDC->DrawText( strInfo, rcWnd, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->SelectObject( oldFont );
cf.DeleteObject(); // 删除字体对象
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?