企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```c++ //虚线在 粗度为1时才有效 //闭合图形跟开放图形 //Polygon 跟PolyLin //Chord 跟Arc //Retanble 、 Ellipse 和 MoveTo、LineTo void CCPenDlg::OnPaint() { CPaintDC dc(this); dc.MoveTo(20,20); dc.LineTo(200,200); CPen p1(PS_SOLID,4,RGB(255,0,0)); CPen* pPen = dc.SelectObject(&p1); //直线 dc.MoveTo(20,20); dc.LineTo(120,120); //矩形 dc.Rectangle(20,40,120,80); //画圆 dc.Ellipse(20,90,120,130); CPen p2(PS_DASHDOT,1,RGB(0,0,255)); dc.SelectObject(&p2); dc.Ellipse(20, 90, 120, 130); CPen p3; p3.CreatePen(PS_DASHDOTDOT,1,RGB(0,255,0)); dc.SelectObject(&p3); CPoint ps[] = {CPoint(240,20),CPoint(120,90),CPoint(300,100)}; dc.Polygon(ps,sizeof(ps)/sizeof(ps[0])); CRect rect(140,100,240,160); dc.Ellipse(rect); dc.SelectObject(&p1); CPoint pt1(240, 20),pt2(200,200); dc.Arc(rect, pt1,pt2);//圆弧 dc.Chord(rect, pt1,pt2); //画闭合圆弧 dc.MoveTo(pt1); dc.LineTo(rect.CenterPoint()); dc.LineTo(pt2); CRect rect1(140, 170, 240, 230); CPen p4(PS_NULL,666,RGB(235,111,222)); dc.SelectObject(&p4); /**dc.Rectangle(rect); //上面三句话等价于一句话 dc.FillSolidRect(rect1,RGB(255,0,255));*/ CBrush br(RGB(255,0,255)); CBrush* pBrush = dc.SelectObject(&br); dc.Rectangle(rect1); //CDialogEx::OnPaint(); } ```