int SetMapMode(int nMapMode); |
void CExoDraw1View::OnPaint() { CPaintDC dc(this); // device context for painting dc.SetMapMode(MM_TEXT); dc.SetViewportOrg(380, 220); // Use a red pen CPen PenRed(PS_SOLID, 1, RGB(255, 0, 0)); dc.SelectObject(PenRed); // A circle whose center is at the origin (0, 0) dc.Ellipse(-100, -100, 100, 100); // Use a blue pen CPen PenBlue(PS_SOLID, 1, RGB(0, 0, 255)); dc.SelectObject(PenBlue); // Horizontal axis dc.MoveTo(-380, 0); dc.LineTo(380, 0); // Vertical axis dc.MoveTo(0, -220); dc.LineTo(0, 220); // An orange pen CPen PenOrange(PS_SOLID, 1, RGB(255, 128, 0)); dc.SelectObject(PenOrange); // A diagonal line at 45 degrees dc.MoveTo(0, 0); dc.LineTo(120, 120); } |
![]() 圖十、代碼效果圖 |
![]() 圖十一、MM_LOENGLISH映射模式下的坐標(biāo)系 |
void CExoDraw1View::OnPaint() { CPaintDC dc(this); // device context for painting dc.SetMapMode(MM_LOENGLISH); dc.SetViewportOrg(380, 220); . . . } |
![]() 圖十二、代碼效果圖 |
void CExoDraw1View::OnPaint() { CPaintDC dc(this); // device context for painting dc.SetMapMode(MM_HIENGLISH); dc.SetViewportOrg(380, 220); . . . Same as previous } |
![]() 圖十三、代碼效果圖 |
void CExoDraw1View::OnPaint() { CPaintDC dc(this); // device context for painting dc.SetMapMode(MM_LOMETRIC); dc.SetViewportOrg(380, 220); . . . } |
![]() 圖十四、代碼效果圖 |
void CExoDraw1View::OnPaint() { CPaintDC dc(this); // device context for painting dc.SetMapMode(MM_HIMETRIC); dc.SetViewportOrg(380, 220); . . . Same as previous } |
![]() 圖十五、代碼效果圖 |
void CExoDraw1View::OnPaint() { CPaintDC dc(this); // device context for painting CRect Recto; dc.SetMapMode(MM_TWIPS); dc.SetViewportOrg(380, 220); . . . } |
![]() 圖十六、代碼效果圖 |
聯(lián)系客服