开发者

C# How to show the progressbar according to my percentage

开发者 https://www.devze.com 2023-04-04 23:00 出处:网络
I included a download option in my Windows application. I would like to update the progress bar result as per my calculated percen开发者_JAVA百科tage. I calculated the percentage in one class and used

I included a download option in my Windows application. I would like to update the progress bar result as per my calculated percen开发者_JAVA百科tage. I calculated the percentage in one class and used yield return to return the percentage:

 int percertage = ((int)(((decimal)Offset / (decimal)FileSize) * 100));
 yield return "Percentage: " + percertage.ToString() + "%";

How do I assign it to my progress bar update the value according to the percentage?


In the progress bar we have a function called PerformStep() using which we can make the progress of the progress bar increase slightly.

pBar1.PerformStep();


try this:

int percertage= ((int)(((decimal)Offset / (decimal)FileSize) * 100));
pgbrValue.Value = percertage;//it's in C#
yield return "Percentage : " + percertage.ToString() + "%";
0

精彩评论

暂无评论...
验证码 换一张
取 消