zoukankan      html  css  js  c++  java
  • 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;
            }
    

      

  • 相关阅读:
    StatusStrip控件的使用(转:http://blog.sina.com.cn/s/blog_4f18c3ec0100fguf.html)
    linux根文件系统
    git使用技巧
    修改git用户名
    luci中添加application
    openwrt安装依赖库
    STM32(二十九)定时器介绍
    openwrt部分文件解析
    uci.js文件解析
    矿机算力
  • 原文地址:https://www.cnblogs.com/weloglog888/p/7040138.html
Copyright © 2011-2022 走看看