程序设计题
发布网友
发布时间:2022-05-01 19:32
我来回答
共2个回答
热心网友
时间:2022-06-30 14:17
CPen pen,*ppen;
CBrush br,*pbr;
pen.CreatePen(PS_SOLID,1,RGB(0,0,128);
br.CreateSolidBrush(RGB(255,0,0);
ppen=pDC->SelectObject(&pen);
pbr=pDC->SelectObject(&br);
pDC->Ellipse(x1,y1,x2,y2);
ppen=pDC->SelectObject(ppen);
pbr=pDC->SelectObject(pbr);
pen.DeleteObject();
br.DeleteObject();
/*visual studio 2005*/
热心网友
时间:2022-06-30 14:18
/*21chenxb's work
2010-6-26
VC++6.0
*/
CXXXXView::OnDraw(CDC* pDC)
{
CXXXXDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CPen penBlue;
penBlue.CreatePen(PS_SOLID,2,RGB(0,0,255));
pDC->SelectObject(&penBlue);
CRect rectClient;
GetClientRect(rectClient);//获得当前窗口客户区大小
CBrush redBrush(RGB(255,0,0));
pDC->SelectObject(&redBrush);
pDC->SetMapMode(MM_ANISOTROPIC);//设置MM_ANISOTROPIC映射模式
pDC->SetWindowExt(1000,1000);//设置窗口范围
pDC->SetViewportExt(rectClient.right,-rectClient.bottom);//设置视口范围
pDC->SetViewportOrg(rectClient.right/2,rectClient.bottom/2);//设置视口原点
pDC->Ellipse(CRect(-500,-500,500,500));
}