标签:
1 void CMy00View::OnDraw(CDC* pDC) 2 { 3 CMy00Doc* pDoc = GetDocument(); 4 ASSERT_VALID(pDoc); 5 // TODO: add draw code for native data here 6 7 COLORREF clr; 8 int x=20,y=20; 9 pDC->SetPixelV(x,y,RGB(255,0,0)); 10 clr=pDC->GetPixel(x,y); 11 pDC->SetPixelV(x+100,y,clr);//像素点 12 pDC->Rectangle(100,200,200,300);//矩形 13 }
效果如下:
1 void CMy00View::OnDraw(CDC* pDC) 2 { 3 CMy00Doc* pDoc = GetDocument(); 4 ASSERT_VALID(pDoc); 5 // TODO: add draw code for native data here 6 //从起点P0(20,30)到终点P1(200,300)画一条1像素宽的蓝色直线, 7 CPen NewPen,*p01dPen; 8 NewPen.CreatePen(PS_SOLID,1,RGB(0,0,255)); 9 p01dPen=pDC->SelectObject(&NewPen); 10 pDC->MoveTo(20,30); 11 pDC->LineTo(200,300); 12 pDC->SelectObject(p01dPen); 13 NewPen.DeleteObject(); 14 }
1 void CMy00View::OnDraw(CDC* pDC) 2 { 3 CMy00Doc* pDoc = GetDocument(); 4 ASSERT_VALID(pDoc); 5 // TODO: add draw code for native data here 6 CPen NewPen,*p01dPen; 7 NewPen.CreatePen(PS_SOLID,1,RGB(0,0,255)); 8 p01dPen=pDC->SelectObject(&NewPen); 9 CBrush NewBrush,*p01dBrush; 10 NewBrush.CreateSolidBrush(RGB(0,255,0)); 11 p01dBrush=pDC->SelectObject(&NewBrush); 12 pDC->Rectangle(100,100,600,300); 13 pDC->SelectObject(p01dBrush); 14 NewBrush.DeleteObject(); 15 }
效果如下:
利用Microsoft VC++6.0 的MFC 的绘图工具实现简单图形的绘制
标签:
原文地址:http://www.cnblogs.com/shenxiaolin/p/5295995.html