c# - 如何制作一半“RadialProgressBar”
解决方案
Windows 社区工具包中有一个类似的控件:RadialGauge,您应该检查一下。另外,如果您想学习如何制作此类控件,请参阅RadialGauge
此处的源代码。
话虽如此,您可以使用Path
来实现这样的 UI。这是我得到的结果:
从这个 XAML :
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Stroke="Gray" StrokeThickness="5">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="10,60">
<PathFigure.Segments>
<ArcSegment
x:Name="DialArc"
Point="110,60"
Size="50,50"
SweepDirection="Clockwise" />
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<Path Stroke="DeepPink" StrokeThickness="5">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="10,60">
<PathFigure.Segments>
<ArcSegment
Point="60,10"
Size="50,50"
SweepDirection="Clockwise" />
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<TextBlock Text="62%" HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
</Grid>
但同样,我强烈建议您使用RadialGauge
社区工具包中的
推荐阅读
- java - ArrayList<> 按字母顺序分两部分排序取决于是否标记了标志
- python - 由于 EnvironmentError python 无法安装软件包
- python - 由于环境错误,无法安装 python 包
- jquery - 类似的 xhr 请求在 chrome 和 firefox 中需要不同的时间
- spring - 如何在 Spring Boot 属性中使用环境变量
- javascript - TypeError:无法读取 ReactJS 中未定义的属性“绑定”
- c# - 注入实例内 IServiceProvider 服务生命周期的解析
- c - ZIP 虚拟文件系统中缺少外部函数
- javascript - 如何从分配给同一项目的更多任务中选择值
- android - Firebase 下载 onProgressListener 不经常被调用