本文介绍了如何在WPF中将任何路径绘图用作progressBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个绘图的路径数据,我想将它用作progressBar,它的透明区域将根据进度值填充红色。

像这样 -

[]

你能说明怎么做它?



我已经这样做了

[]



但问题是progressBar包含Blocks,I想要顺利进步像我上面的图像我有发布。



我已经在网上搜索了删除块,发现它正在发生旧的Luna汇编引用来自这个url-

[]

在此网址中,使用了ProgressBarBrushConverter.cs,但我无法将Luna的引用替换为 ProgressBarBrushConverter.cs用于

 <   MultiBinding。转换器 >  
< 转换器:ProgressBarBrushConverter / >
< / MultiBinding.Converter >





上面图片的路径数据是 -

数据=F1M307.5,21.75C303.765,21.75 300.51,19.701 298.793,16.667 298.793,16.667 242.207,16.667 242.207,16.667 240.49,19.701 237.235,21.75 233.5,21.75 229.765,21.75 226.51,19.701 224.793,16.667 224.793,16.667 168.207,16.667 168.207,16.667 166.49,19.701 163.235,21.75 159.5, 21.75 155.765,21.75 152.51,19.701 150.793,16.667 150.793,16.667 94.207,16.667 94.207,16.667 92.49,19.701 89.235,21.75 85.5,21.75 81.765,21.75 78.51,19.701 76.793,16.667 76.793,16.667 20.207,16.667 20.207,16.667 18.49,19.701 15.235 ,21.75 11.5,21.75 5.977,21.75 1.5,17.273 1.5,11.75 1.5,6.227 5.977,1.75 11.5,1.75 15.167,1.75 18.37,3.724 20.111,6.667 20.111,6.667 76.889,6.667 76.889,6.667 78.63,3.724 81.8 33,1.75 85.5,1.75 89.167,1.75 92.37,3.724 94.111,6.667 94.111,6.667 150.889,6.667 150.889,6.667 152.63,3.724 155.834,1.75 159.5,1.75 163.167,1.75 166.37,3.724 168.111,6.667 168.111,6.667 224.889,6.667 224.889, 6.667 226.63,3.724 229.834,1.75 233.5,1.75 237.167,1.75 240.37,3.724 242.111,6.667 242.111,6.667 298.889,6.667 298.889,6.667 300.63,3.724 303.833,1.75 307.5,1.75 313.023,1.75 317.5,6.227 317.5,11.75 317.5,17.273 313.023 ,21.75 307.5,21.75z





为方便起见我上传了解决方案档案,如果你能帮助我,我将非常感谢!

解决方案文件的链接 -

[]



感谢您的时间,请帮助我,我正在努力个月。

解决方案

Suppose I have a Path data of a drawing and I want to use it as a progressBar and It's transparent area will be filled with red color according to progress value.
Like this-
http://i.stack.imgur.com/27Ps4.png[^]
Can you tell how to do it?

I already did this
http://vbcity.com/blogs/xtab/archive/2009/11/24/wpf-controltemplates-creating-a-non-rectangular-progressbar.aspx[^]

But the problem is that the progressBar contains "Blocks", I want smooth progressBar like I above image I have posted.

I have searched the web to remove the blocks and found that it was happening for the old "Luna" assembly reference from this url-
http://stackoverflow.com/questions/25837798/get-rid-of-white-background-in-progressbar[^]
In this url, the "ProgressBarBrushConverter.cs" was used, but I couldn't replace the reference of "Luna" with "ProgressBarBrushConverter.cs" for the

<MultiBinding.Converter>
   <converter:ProgressBarBrushConverter />
 </MultiBinding.Converter>

in the xaml file.

The Path data of the above image is-

Data="F1M307.5,21.75C303.765,21.75 300.51,19.701 298.793,16.667 298.793,16.667 242.207,16.667 242.207,16.667 240.49,19.701 237.235,21.75 233.5,21.75 229.765,21.75 226.51,19.701 224.793,16.667 224.793,16.667 168.207,16.667 168.207,16.667 166.49,19.701 163.235,21.75 159.5,21.75 155.765,21.75 152.51,19.701 150.793,16.667 150.793,16.667 94.207,16.667 94.207,16.667 92.49,19.701 89.235,21.75 85.5,21.75 81.765,21.75 78.51,19.701 76.793,16.667 76.793,16.667 20.207,16.667 20.207,16.667 18.49,19.701 15.235,21.75 11.5,21.75 5.977,21.75 1.5,17.273 1.5,11.75 1.5,6.227 5.977,1.75 11.5,1.75 15.167,1.75 18.37,3.724 20.111,6.667 20.111,6.667 76.889,6.667 76.889,6.667 78.63,3.724 81.833,1.75 85.5,1.75 89.167,1.75 92.37,3.724 94.111,6.667 94.111,6.667 150.889,6.667 150.889,6.667 152.63,3.724 155.834,1.75 159.5,1.75 163.167,1.75 166.37,3.724 168.111,6.667 168.111,6.667 224.889,6.667 224.889,6.667 226.63,3.724 229.834,1.75 233.5,1.75 237.167,1.75 240.37,3.724 242.111,6.667 242.111,6.667 298.889,6.667 298.889,6.667 300.63,3.724 303.833,1.75 307.5,1.75 313.023,1.75 317.5,6.227 317.5,11.75 317.5,17.273 313.023,21.75 307.5,21.75z"



For ease I have uploaded the solution File, I will be thankful if you can help me!
Link for the solution file-
https://drive.google.com/file/d/0B1kVJUcRUWHWTzJPSDB2N2tlUDQ/view?usp=sharing[^]

Thank you for your time, please help me, I am trying from months.

解决方案


这篇关于如何在WPF中将任何路径绘图用作progressBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 01:34