Progress Bar - How do you assume decimal values?

0

By learning, I'm creating a good beast in C # and I make a progress bar the life bar, but I need to decrease a decimal value and apparently progress only assumes int values. How can I make it display decimal values such as 99.2%?

The Progress bar is naturally set to a minimum of 0 and a maximum of 100. Line that decreases in life:

lifeP1.Value -= (int)(ataque2);
    
asked by anonymous 07.05.2018 / 23:56

1 answer

1

You can set the Maximum property value of the ProgressBar to a higher value and multiply. For example, you can set the Maximum value to 1000 and at the time of setting the Value you can put 99.2 * 10 = 992 , still within range

    
08.05.2018 / 00:00