void CGDIplus2Dlg::OnDrawRectangle()
{
Pen* myPen = new Pen(Color(255, 255, 0, 0), 3);//红笔
Graphics* myGraphics;
CClientDC dc(this);
HDC hdc=dc.m_hDC;
myGraphics = new Graphics(hdc);//Graphics就像在模仿Delphi的Canvas
myGraphics->DrawRectangle(myPen, 100, 50, 80, 40);
Rect myRect(200, 50, 80, 40);
myGraphics->DrawRectangle(myPen, myRect);
delete myPen;
delete myGraphics;
}
void CGDIplus2Dlg::OnDrawEllipse()
{
Pen* myPen = new Pen(Color(255, 255, 0, 0), 3);//红笔
Graphics* myGraphics;
CClientDC dc(this);
HDC hdc=dc.m_hDC;
myGraphics = new Graphics(hdc);//Graphics就像在模仿Delphi的Canvas
//myGraphics->DrawRectangle(myPen, 100, 50, 80, 40);
myGraphics->DrawEllipse(myPen, 100, 50, 160, 80);
Pen* myPenBlue = new Pen(Color(255, 0, 0, 255), 1);//蓝笔
myGraphics->DrawArc(myPenBlue, 100, 50, 160, 80, 90, 90);
//Rect myRect(200, 50, 80, 40);
//myGraphics->DrawRectangle(myPen, myRect);
Rect myRect(100, 150, 160, 80);
myGraphics->DrawEllipse(myPen, myRect);
myGraphics->DrawRectangle(myPen, myRect);
delete myPen;
delete myPenBlue;
delete myGraphics;
}
CGDIplus2Dlg::OnDrawEllipse()
最新推荐文章于 2021-07-19 21:33:14 发布