角度 a : double a = Math.Acos(<余弦值[0.5]>)/Math.PI*180; //a = 60
private void DrawingPicImage(Temps t) { int w = pictureBox2.Width; int h = pictureBox2.Height; Bitmap bit = new Bitmap(w, h); Graphics g = Graphics.FromImage(bit); using (g) { Pen p = new Pen(Color.Black); SolidBrush solidB = new SolidBrush(Color.LightSteelBlue); StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; Font tf = new Font("宋体", 18, FontStyle.Regular); g.SmoothingMode = SmoothingMode.AntiAlias; double r = 100.0;//直径 double jindu = t.H_Rate * 100.0 / Standard;//进度 达成率 Rectangle rc = new Rectangle(0, 0, (int)r, (int)r); Point pp = new Point(0,0); GraphicsPath gp = new GraphicsPath(); // //根据直角三角形两边 获取角度 // double jd = Math.Acos((r / 2.0 - jindu) / (r / 2.0)) / Math.PI * 180; gp.AddArc(rc, (float)(90 - jd), (float)(jd * 2)); g.FillPath(solidB,gp); p.Width = 1; p.Color = Color.SteelBlue; g.DrawArc(p, 0,0,(int)r,(int)r, 360,360); g.DrawString(t.H_Rate + "%", tf, new SolidBrush(Color.Black), (int)(r / 2), (int)(r / 2) - 9, stringFormat); } pictureBox2.Image = bit; }