图五、代码效果图 |
需要注意的是,你也可以相对于客户区域来指定坐标原点
| void CExoDraw1View::OnPaint() { CPaintDC dc(this); //绘图的设备上下文; CRect Recto; //获取客户区尺寸; GetClientRect(&Recto); dc.SetViewportOrg(Recto.Width() / 2, Recto.Height() / 2); // A circle whose center is at the origin (0, 0) dc.Ellipse(-50, -50, 50, 50); // A line that starts at (0, 0) and ends at (100, 100) dc.MoveTo(0, 0); dc.LineTo(100, 100); } |
图六、代码效果图 |
现在你已了解了如何设置坐