15,979
社区成员
发帖
与我相关
我的任务
分享
void CMainFrame::OnNcPaint()
{
// TODO: 在此处添加消息处理程序代码
// 不为绘图消息调用 CFrameWndEx::OnNcPaint()
CDC* pDC = GetWindowDC();
int x = GetSystemMetrics(SM_CXSIZE)+GetSystemMetrics(SM_CXBORDER)+GetSystemMetrics(SM_CXDLGFRAME);
int y = GetSystemMetrics(SM_CYDLGFRAME);
CRect CapRct;
GetWindowRect(&CapRct);
int y1 = GetSystemMetrics(SM_CYICON)-GetSystemMetrics(SM_CYDLGFRAME)-GetSystemMetrics(SM_CYBORDER);
int x1 = CapRct.Width ()- GetSystemMetrics(SM_CXSIZE)-GetSystemMetrics(SM_CXBORDER)-GetSystemMetrics(SM_CXDLGFRAME);
CapRct.left = x;
CapRct.top = y;
CapRct.right = x1;
CapRct.bottom = y1;
//pDC->FillSolidRect(&CapRct,RGB(0,0,0));
CFont* pCurFont = this->GetFont();
if (pCurFont != NULL)
{
LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
pCurFont->GetLogFont(&lf);
/*lf.lfItalic = FALSE;
lf.lfWeight = FW_BOLD; */
lf.lfHeight = 18;
//_tcscpy_s(lf.lfFaceName, 32, _T("宋体"));
//strcpy(lf.lfFaceName,"Arial");
CFont capfont;
capfont.CreateFontIndirect(&lf);
pCurFont = pDC->SelectObject(&capfont);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT));
pDC->DrawText(STRING_CONSOLE_TITLE, &CapRct, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
ReleaseDC(pDC);
}