看得破的人,处处都是生机;

看不破的人,处处都是困境;

拿得起的人,处处都是担当;

拿不起的人,处处都是疏忽;

放得下的人,处处都是大道;

放不下的人,处处都是迷茫;

想得开的人,处处都是春天;

想不开的人,处处都是凋枯;

做何人,在自己;

小自我,大天地;

c# math

角度 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;
        }

  

posted @ 2017-06-17 14:18  心电心  阅读(259)  评论(0编辑  收藏  举报