zoukankan      html  css  js  c++  java
  • WPF自定义进度条

    <!--进度条 4812-->
    <LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill" StartPoint="0,0" EndPoint="1,0">
    <GradientStop Color="#00EEEE" Offset="0.2"/>
    <GradientStop Color="#00EEEE" Offset="0.4"/>
    <GradientStop Color="#00EEEE" Offset="0.6"/>
    <GradientStop Color="#00EEEE" Offset="1"/>
    </LinearGradientBrush>
    <Style x:Key="ProgressBarBaseStyle" TargetType="{x:Type ProgressBar}">
    <Setter Property="Height" Value="20"/>
    <Setter Property="Background" Value="White"/>
    <Setter Property="BorderBrush" Value="#19000000"/>
    <Setter Property="BorderThickness" Value="0,0,0,0"/>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type ProgressBar}">
    <Grid>
    <Border x:Name="TemplateRoot" CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
    <Border.Effect>
    <BlurEffect Radius="2"></BlurEffect>
    </Border.Effect>
    </Border>
    <Grid Margin="{TemplateBinding BorderThickness}">
    <Rectangle x:Name="PART_Track"/>
    <Grid HorizontalAlignment="Left">
    <Decorator x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="0,-1,0,0">
    <Border CornerRadius="4" x:Name="Animation" ClipToBounds="true" Background="{TemplateBinding Foreground}">
    <Rectangle x:Name="PART_GlowRect" Fill="{StaticResource ProgressBarIndicatorAnimatedFill}" HorizontalAlignment="Left" Margin="0,0,0,0" Width="100"/>
    </Border>
    </Decorator>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
    <Label FontSize="12" Foreground="#000" Padding="0,0,0,0" Content="{TemplateBinding Value}"></Label>
    <Label FontSize="12" Foreground="#000" Padding="0,0,0,0" Content="%"></Label>
    </StackPanel>
    </Grid>
    </Grid>
    </Grid>
    <ControlTemplate.Triggers>
    <Trigger Property="Orientation" Value="Vertical">
    <Setter Property="LayoutTransform" TargetName="TemplateRoot">
    <Setter.Value>
    <RotateTransform Angle="-90"/>
    </Setter.Value>
    </Setter>
    </Trigger>
    </ControlTemplate.Triggers>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <Style x:Key="progress-bar-gif" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="{x:Type ProgressBar}">
    <Setter Property="Foreground" Value="#00EEEE"/>
    </Style>
    
    使用方法: <ProgressBar Style="{DynamicResource progress-bar-gif}"  Name="DownProgressBar"></ProgressBar>  在后台填写数值就可以了
    每天进步一点点。
  • 相关阅读:
    margin 碰到过的重叠问题
    等宽字体延伸到的 ch 长度单位和动画 animation-timing-function
    三栏布局 左右固定 中间自适应
    左侧固定,右侧自适应的五种布局方式
    jmeter环境配置
    python3 + selenum 环境搭建
    win10系统安装loadrunner11提示“为了对电脑进行保护 已经阻止此应用”的解决方案
    关于loadrunner运行场景时提示“初始化失败,通信错误”的解决方案
    安装phpwind报错
    关于XAMPP Apache无法启动问题解决方案
  • 原文地址:https://www.cnblogs.com/snow-zhang/p/10103054.html
Copyright © 2011-2022 走看看