16,472
社区成员
发帖
与我相关
我的任务
分享
void MyStatic::OnPaint()
{
//CPaintDC dc(this); // device context for painting
CDC *pDC = GetDC();
int oldMode=pDC->SetBkMode(TRANSPARENT);
CString strTitle;
GetWindowText(strTitle);
CFont ft;
ft.CreatePointFont(100,"宋体",NULL);
pDC->SelectObject(&ft);
pDC->TextOut(0,0,strTitle);
pDC->SetBkMode(oldMode);
ReleaseDC(pDC);
// TODO: Add your message handler code here
// Do not call CStatic::OnPaint() for painting messages
}
void NewGeneralStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting
int oldMode=dc.SetBkMode(TRANSPARENT);
CString strTitle;
GetWindowText(strTitle);
CFont ft;
ft.CreatePointFont(100,"宋体",NULL);
dc.SelectObject(&ft);
dc.TextOut(0,0,strTitle);
dc.SetBkMode(oldMode);
// TODO: Add your message handler code here
// Do not call CStatic::OnPaint() for painting messages
}
就好了,CDC *pDC = GetDC();这一句坑爹呀, 不知道什么原因。