MFC CPen CBrush CFont

在OnDraw函数内定义后使用

使用时,要pDC->SelectObject(),如pDC->SelectObject(font);

 

CPen://draw line

Pen.CreatePen(PS_SOLID, 2, RGB(250, 0, 0));

pDC->MoveTo(x, y);//origin

pDC->LineTo(x, y);//destination

 

 

CBrush://draw shapes

Brush.CreateSolidBrush(RGB(50, 250, 0));

pDC->Rectangle(x1, y1, x2,y2);

 

CFont://draw characters

font.CreateFont(0, 0, 0, 0, 10/*字体颜色深浅*/, 0, 0, 0, OEM_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _T("楷体"));

CString showText;

showText.Format(_T("%d"),temp);

pDC->TextOut(x,y showText);

 

posted @ 2016-01-09 01:20  Ficow  阅读(708)  评论(0编辑  收藏  举报