//设定文字大小和颜色 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);

05-11 23:01