WPF: Creating dynamic progress indicator
I'm currently trying to write an application with a progres开发者_运维百科s indicator in C# using WPF:
<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
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
- Split it up into 3 columns, with a path in each column. 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.
- Create a rectangle with a radius the same as your inner corners and put it in the 2nd columns.
- 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.
精彩评论