您当前的位置: 首页 > 

光怪陆离的节日

暂无认证

  • 1浏览

    0关注

    1003博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

WPF 环形进度条的使用

光怪陆离的节日 发布时间:2022-09-20 09:00:04 ,浏览量:1

环形进度条 在这里插入图片描述

一、新建一个用户控件:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes;

namespace BeatfanControls.ProcessBars { /// /// CycleProcessBar1.xaml 的交互逻辑 /// public partial class CycleProcessBar1 : UserControl { public CycleProcessBar1() { InitializeComponent(); }

    public double CurrentValue1
    {
        set { SetValue(value); }
    }

    /// 
    /// 设置百分百,输入小数,自动乘100
    /// 
    /// 
    private void SetValue(double percentValue)
    {
        /*****************************************
          方形矩阵边长为34,半长为17
          环形半径为14,所以距离边框3个像素
          环形描边3个像素
        ******************************************/
        double angel = percentValue * 360; //角度

        

        double radius = 14; //环形半径

        //起始点
        double leftStart = 17;
        double topStart = 3;

        //结束点
        double endLeft = 0;
        double endTop = 0;

        

        //数字显示
        lbValue.Content = (percentValue*100).ToString("0") + "%";

        /***********************************************
        * 整个环形进度条使用Path来绘制,采用三角函数来计算
        * 环形根据角度来分别绘制,以90度划分,方便计算比例
        ***********************************************/

        bool isLagreCircle = false; //是否优势弧,即大于180度的弧形

        //小于90度
        if (angel             
关注
打赏
1665731445
查看更多评论
0.0427s