<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      1.編寫圓形進度環組件CircularProgressBar.xam

      <UserControl x:Class="Wpf.Industrial.Controls.CircularProgressBar"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                   xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                   xmlns:local="clr-namespace:Wpf.Industrial.Controls"
                   mc:Ignorable="d" 
                   d:DesignHeight="150" d:DesignWidth="150">
          <Grid Name="layout" Height="{Binding RelativeSource={RelativeSource Self},Path=Width}">
              <Ellipse Width="{Binding ElementName=layout,Path=ActualWidth}"
                       Height="{Binding RelativeSource={RelativeSource Self},Path=Width}"
                       StrokeThickness="6"
                       Stroke="{Binding BackColor,RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}" 
                       Name="backEllipse">
                  <Ellipse.Effect>
                      <DropShadowEffect ShadowDepth="0" Direction="0" Color="White" BlurRadius="5" />
                  </Ellipse.Effect>
              </Ellipse>
      
              <Path Name="path" StrokeStartLineCap="Round" StrokeEndLineCap="Round"
               Stroke="{Binding ForeColor,RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}" 
               StrokeThickness="4"/>
              
              <Viewbox Margin="14">
                  <TextBlock  VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White">
                        <Run FontSize="20" Text="{Binding Value,RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"/>
                        <Run Text="%"/>
                  </TextBlock>
              </Viewbox>
          </Grid>
      </UserControl>
      View Code

       

      2.后臺代碼實現進度值和顏色的邏輯交互CircularProgressBar.xam.cs

          /// <summary>
          /// CircularProgressBar.xaml 的交互邏輯
          /// </summary>
          public partial class CircularProgressBar : UserControl
          {
              public double Value
              {
                  get { return (double)GetValue(ValueProperty); }
                  set { SetValue(ValueProperty, value); }
              }
              public static readonly DependencyProperty ValueProperty =
                  DependencyProperty.Register("Value", typeof(double), typeof(CircularProgressBar), new PropertyMetadata(0.0, new PropertyChangedCallback(OnPropertyChanged)));
      
              public Brush BackColor
              {
                  get { return (Brush)GetValue(BackColorProperty); }
                  set { SetValue(BackColorProperty, value); }
              }
              public static readonly DependencyProperty BackColorProperty =
                  DependencyProperty.Register("BackColor", typeof(Brush), typeof(CircularProgressBar), new PropertyMetadata(Brushes.LightGray));
      
              public Brush ForeColor
              {
                  get { return (Brush)GetValue(ForeColorProperty); }
                  set { SetValue(ForeColorProperty, value); }
              }
              public static readonly DependencyProperty ForeColorProperty =
                  DependencyProperty.Register("ForeColor", typeof(Brush), typeof(CircularProgressBar), new PropertyMetadata(Brushes.Orange));
      
      
      
              private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
              {
                  (d as CircularProgressBar).UpdateValue();
              }
      
              public CircularProgressBar()
              {
                  InitializeComponent();
      
                  this.SizeChanged += CircularProgressBar_SizeChanged;
              }
      
              private void CircularProgressBar_SizeChanged(object sender, SizeChangedEventArgs e)
              {
                  this.UpdateValue();
                  this.SizeChanged += CircularProgressBar_SizeChanged;
              }
      
              private void UpdateValue()
              {
                  this.layout.Width = Math.Min(this.RenderSize.Width, this.RenderSize.Height);
                  this.layout.Height = Math.Min(this.RenderSize.Width, this.RenderSize.Height);
                  double radius = Math.Min(this.RenderSize.Width, this.RenderSize.Height) / 2;
                  if (radius <= 0) return;
      
                  double newX = 0.0, newY = 0.0;
                  newX = radius + (radius - 3) * Math.Cos((this.Value % 100.0 * 3.6 - 90) * Math.PI / 180);
                  newY = radius + (radius - 3) * Math.Sin((this.Value % 100.0 * 3.6 - 90) * Math.PI / 180);
      
                  string pathDataStr = "M{0} 3A{3} {3} 0 {4} 1 {1} {2}";
                  pathDataStr = string.Format(pathDataStr,
                      radius + 0.01,
                      newX,
                      newY,
                      radius - 3,
                      this.Value < 50 ? 0 : 1);
                  var converter = TypeDescriptor.GetConverter(typeof(Geometry));
                  this.path.Data = (Geometry)converter.ConvertFrom(pathDataStr);
      
              }
          }
      View Code

       

      3.其他頁面使用該組件展示環形進度

                      <UniformGrid Columns="3" Margin="0,40,0,0">
                          <StackPanel>
                              <TextBlock Text="監控值" HorizontalAlignment="Center" Foreground="#99FFFFFF"/>
                              <control:CircularProgressBar Value="10"  Width="60" Height="90" BackColor="#EEE" ForeColor="#20c9b4"/>
                          </StackPanel>
                          <StackPanel>
                              <TextBlock Text="監控值" HorizontalAlignment="Center" Foreground="#99FFFFFF"/>
                              <control:CircularProgressBar Value="63" Width="60" Height="90" BackColor="#EEE" ForeColor="Orange"/>
                          </StackPanel>
                          <StackPanel>
                              <TextBlock Text="監控值" HorizontalAlignment="Center"  Foreground="#99FFFFFF"/>
                              <control:CircularProgressBar Value="38" Width="60" Height="90" BackColor="#EEE" ForeColor="#38baec"/>
                          </StackPanel>
                      </UniformGrid>
      View Code

       

      4.使用后顯示的效果圖

       

      posted on 2025-01-14 15:44  江漁湖  閱讀(57)  評論(0)    收藏  舉報

      主站蜘蛛池模板: 人妻丝袜AV中文系列先锋影音| 亚洲第一视频区| 日韩精品亚洲精品第一页| 国产精品不卡区一区二| 亚洲加勒比久久88色综合| 国产成人免费ā片在线观看| 色狠狠综合天天综合综合| 亚洲国产日韩精品一区二区三区| 亚洲一区二区三区在线播放无码| 色偷偷成人综合亚洲精品| 国产精品一区二区三区三级| 国产91午夜福利精品| 欧美成人午夜性视频| 亚洲精品中文av在线| 六盘水市| 国产精品白丝一区二区三区| 日韩免费视频一一二区| 亚欧洲乱码视频一二三区| 国产v综合v亚洲欧美久久| 国产精品老熟女一区二区| 国产午夜精品福利视频| 庐江县| 亚洲精品中文字幕一区二| 无码激情亚洲一区| 无极县| 午夜爽爽爽男女免费观看影院| 麻豆精品一区二正一三区| 少妇人妻偷人精品免费| 亚洲天堂av日韩精品| 她也色tayese在线视频| 亚洲成av人片一区二区| 国产一区二区丰满熟女人妻| 国产精品高清视亚洲中文| 免费人成视频在线| gogo无码大胆啪啪艺术| 亚洲在av极品无码天堂| 亚洲综合久久精品哦夜夜嗨| a∨变态另类天堂无码专区| 国产麻豆精品一区一区三区| 亚洲午夜成人精品电影在线观看 | 国产成人剧情AV麻豆果冻|