想对话框写文字

来源:互联网 发布:淘宝客服的感想 编辑:程序博客网 时间:2024/05/21 18:30
CPaintDC pDc(m_hWnd);
CRect Rect;
GetClientRect(Rect);

CDC memDc;
memDc.CreateCompatibleDC(pDc);
CBitmap tempBMP;
tempBMP.CreateCompatibleBitmap(pDc, Rect.right - Rect.left, Rect.bottom - Rect.top);
HBITMAP hBmpOld = memDc.SelectBitmap(tempBMP);

COLORREF crColor = RGB(255,0,0);

CFont  m_fontTopic.CreateFont(10, 10,0,0,0,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS, _T("宋体"));

HFONT hFontOld = memDc.SelectFont(m_fontTopic.m_hFont);
//SetBkMode(memDc.m_hDC,TRANSPARENT);//设置所写字的背景
memDc.SetTextColor(crColor);

CString str = _T("FANUC_LATHEOPII");
memDc.TextOut(0,0,str,str.GetLength());
memDc.SelectFont(hFontOld);
CDC dcPanelFanSK50 = GetDC(); //m_pDrawFanSK50->GetDC();
dcPanelFanSK50.BitBlt(95,2,150,10, memDc, 0, 0, SRCCOPY);
ReleaseDC(dcPanelFanSK50);
原创粉丝点击