本文介绍了用三点绘制弧线..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 用三点绘制弧线.. ?? 帮我找到这个.. private void Form1_MouseDown(object sender,MouseEventArgs e) { Graphics gs = this.CreateGraphics(); if(pt [0] .X == 0 && pt [0] .Y == 0) { pt [0] .X = eX; pt [0] .Y = eY; } else if(pt [1] .X == 0 && pt [1] .Y == 0) { pt [1] .X = eX; pt [1] .Y = eY; } else if(pt [2] .X == 0 && pt [2] .Y == 0) { pt [2] .X = eX; pt [2] .Y = eY; double dstart = Math.Atan2(pt [0] .Y - pt [1 ] .Y,pt [0] .X - pt [1] .X)* Rad2Deg; double dEnd = Math.Atan2(pt [0] .Y - pt [2] .Y,pt [0 ] .X - pt [2] .X)* Rad2Deg; double dSweep = dEnd - dstart; PointF pMid =新的PointF((pt [0] .X + pt [2] .X)/ 2,(pt [0] .Y + pt [2] .Y)/ 2); double a = pMid.X - pt [0] .X; double b = pMid.Y - pt [0] .Y; double radius = Math.Sqrt(a * a + b * b); double a1 = pMid.X - pt [1]。 X; double b1 = pMid.Y - pt [1] .Y; double radius1 = Math.Sqrt(a1 * a1 + b1 * b1); gs.DrawArc(Pens.Black,pt [0] .X,pt [0]。 Y,Convert.ToInt32(radius * 2),Convert.ToInt32(radius1),Convert.ToInt32(dstart),Convert.ToInt32(dSweep)); } }Drawing an arc with three points ..??Help me to find this.. private void Form1_MouseDown(object sender, MouseEventArgs e) { Graphics gs = this.CreateGraphics(); if (pt[0].X == 0 && pt[0].Y == 0) { pt[0].X = e.X; pt[0].Y = e.Y; } else if (pt[1].X == 0 && pt[1].Y == 0) { pt[1].X = e.X; pt[1].Y = e.Y; } else if (pt[2].X == 0 && pt[2].Y == 0) { pt[2].X = e.X; pt[2].Y = e.Y; double dstart = Math.Atan2(pt[0].Y - pt[1].Y, pt[0].X - pt[1].X) * Rad2Deg; double dEnd = Math.Atan2(pt[0].Y - pt[2].Y, pt[0].X - pt[2].X) * Rad2Deg; double dSweep = dEnd - dstart; PointF pMid = new PointF((pt[0].X + pt[2].X) / 2, (pt[0].Y + pt[2].Y) / 2); double a = pMid.X - pt[0].X; double b = pMid.Y - pt[0].Y; double radius = Math.Sqrt(a * a + b * b); double a1 = pMid.X - pt[1].X; double b1 = pMid.Y - pt[1].Y; double radius1 = Math.Sqrt(a1 * a1 + b1 * b1); gs.DrawArc(Pens.Black, pt[0].X, pt[0].Y, Convert.ToInt32(radius * 2), Convert.ToInt32(radius1), Convert.ToInt32(dstart), Convert.ToInt32(dSweep)); } }解决方案使用 Graphics.DrawCurve方法 [ ^ ] hi, 参考这个 http://stackoverflow.com/questions/2898089/c-sharp -drawing-arc-with-3-points [ ^ ] 谢谢 Magesh Mhi ,Refer thishttp://stackoverflow.com/questions/2898089/c-sharp-drawing-arc-with-3-points[^]ThanksMagesh M 这篇关于用三点绘制弧线..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-03 23:24