2个回答
展开全部
//设定文字大小和颜色
LOGFONT logfont; //改变输出字体
ZeroMemory(&logfont, sizeof(LOGFONT));
logfont.lfCharSet = GB2312_CHARSET;
logfont.lfHeight = -50; //设置字体的大小
HFONT hFont = CreateFontIndirect(&logfont);
HDC hdc=::GetDC(m_hWnd);
::SetTextColor(hdc,RGB(0,255,0));
::SetBkColor(hdc,RGB(200,200,0));
::SetBkMode(hdc,TRANSPARENT);
SelectObject(hdc, hFont);
char szBuffer[40]; //输出文字的格式
::TextOut(hdc,0,0,szBuffer,sprintf(szBuffer,TEXT("jacky")) );
::TextOut(hdc,0,50,szBuffer,sprintf(szBuffer,TEXT("jacky:%d %d"),100,200) );
::ReleaseDC(m_hWnd,hdc) ;
DeleteObject(hFont);
LOGFONT logfont; //改变输出字体
ZeroMemory(&logfont, sizeof(LOGFONT));
logfont.lfCharSet = GB2312_CHARSET;
logfont.lfHeight = -50; //设置字体的大小
HFONT hFont = CreateFontIndirect(&logfont);
HDC hdc=::GetDC(m_hWnd);
::SetTextColor(hdc,RGB(0,255,0));
::SetBkColor(hdc,RGB(200,200,0));
::SetBkMode(hdc,TRANSPARENT);
SelectObject(hdc, hFont);
char szBuffer[40]; //输出文字的格式
::TextOut(hdc,0,0,szBuffer,sprintf(szBuffer,TEXT("jacky")) );
::TextOut(hdc,0,50,szBuffer,sprintf(szBuffer,TEXT("jacky:%d %d"),100,200) );
::ReleaseDC(m_hWnd,hdc) ;
DeleteObject(hFont);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询