CGDIplus2Dlg::OnDrawEllipse()

来源:互联网 发布:mac 不让安装不明文件 编辑:程序博客网 时间:2024/06/08 16:08
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的CanvasmyGraphics->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;}