简体   繁体   English

WPF:创建动态进度指示器

[英]WPF: Creating dynamic progress indicator

I'm currently trying to write an application with a progress indicator in C# using WPF: 我目前正在尝试使用WPF在C#中编写带有进度指示器的应用程序:

<Path Canvas.Left="15" Canvas.Top="50" Stroke="Red" StrokeThickness="6" Data=" M 700,100 L 620,100 C 620,100 600,100 600,80 L 600,50 C 600,50 600,30 580,30 L 50,30 L 50,340 L 580,340 C 580,340 600,340 600,320 L 600,290 C 600,290 600,270 620,270 L 700,270" Name="Progress" StrokeDashCap="Flat" StrokeEndLineCap="Round" StrokeLineJoin="Round" StrokeStartLineCap="Round" StrokeMiterLimit="30">

图片 http://img839.imageshack.us/my.php?image=20100831180406.png http://img839.imageshack.us/my.php?image=20100831180406.png

So far the indicator is finished. 至此指示器已完成。 However I don't have any possibility to lower the length of the indicator yet. 但是我还没有降低指标长度的可能性。 I could redraw the indicator using other coordinates but that would be kind of complicated (think about the rounded parts). 我可以使用其他坐标重绘该指标,但这有点复杂(想想圆角部分)。 Also I can't overlay it with white color as it must be transparent due to a background image. 我也不能用白色覆盖它,因为由于背景图像,它必须是透明的。

Does anyone have an idea on how to achieve what I want? 有人对实现我想要的东西有想法吗? Or point me to another possible solution? 或为我指出另一种可能的解决方案?

Best greetings, Jonas 最好的问候,乔纳斯

I dunno if I'm understanding what you want, but this is what I'd try 如果我了解您想要什么,我不知道,但这就是我会尝试的

  1. Split it up into 3 columns, with a path in each column. 将其分为3列,每列都有一个路径。 The 1st column is has the path for the left edge.. the middle column will just have the top/bottom and will stretch, the right column will contain the right curves/etc. 第一列是左边缘的路径。中间列将仅具有顶部/底部并会拉伸,右列将包含右曲线/等。
  2. Create a rectangle with a radius the same as your inner corners and put it in the 2nd columns. 创建一个半径与内角相同的矩形,并将其放在第二列中。
  3. visualize progress by updating the width of the rectangle. 通过更新矩形的宽度来可视化进度。

This approach would only fill the progress up the "neck" of the bottle-like indicator you made. 这种方法只会填补您制作的瓶状指示器“瓶颈”上的进度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM