c++画圆的程序

CMagtomoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here

if(pDoc->emt->HasCalculated()) 
{
pDoc->emt->DrawImage(pDC);
}
//左边的圆


// POINT pointLeft;
pointLeftx=190;
pointLefty=250;//所画圆的圆心

RL=178;//所画圆的半径


//右边的圆


// POINT pointRight;
//pointRightx=450;
//pointRighty=150;//所画圆的圆心

//RR=100;//所画圆的半径

//左边圆中的小圆


// POINT pointLeft1;
pointLeft1x=(2*pointLeftx-RL)/2;
pointLeft1y=pointLefty;//所画圆的圆心

RL1=30;//所画圆的半径

//左边圆中的小圆


// POINT pointLeft2;
pointLeft2x=(2*pointLeftx+RL)/2;
pointLeft2y=pointLefty;//所画圆的圆心

RL2=30;//所画圆的半径


CClientDC dc(this);//获得设备上下文
COLORREF m_ncolor=155;//(0~255的灰度值)
// 使用画刷
CPen pen(PS_SOLID,5,m_ncolor);
dc.SelectObject(&pen);
CBrush *pBrush=new CBrush(m_ncolor);
dc.SelectObject(pBrush);





dc.Ellipse(pointLeftx-RL,pointLefty-RL,pointLeftx+RL,pointLefty+RL);
// dc.Ellipse(pointRightx-RR,pointRighty-RR,pointRightx+RR,pointRighty+RR);


//画两个小圆

COLORREF m_ncolor1=55;//(0~255的灰度值)
// 使用画刷
/* GDIPlus::LineGradientBrush   blueGradient(Point(0,0),)*/
CPen pen1(PS_SOLID,5,m_ncolor1);
dc.SelectObject(&pen1);
CBrush *pBrush1=new CBrush(m_ncolor1);
dc.SelectObject(pBrush1);

dc.Ellipse(pointLeft1x-RL1,pointLeft1y-RL1,pointLeft1x+RL1,pointLeft1y+RL1);
dc.Ellipse(pointLeft2x-RL2,pointLeft2y-RL2,pointLeft2x+RL2,pointLeft2y+RL2);

你可能感兴趣的:(c++笔记,c++)