* UIProcessBar: 修复值计算过程中的Int越界问题

This commit is contained in:
Sunny 2023-09-06 23:28:38 +08:00
parent 073b782bcf
commit 0a6f8f5e65

View File

@ -24,6 +24,7 @@
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2022-09-05: V3.2.3 1 * 2022-09-05: V3.2.3 1
* 2023-05-12: V3.3.6 DrawString函数 * 2023-05-12: V3.3.6 DrawString函数
* 2023-09-05: V3.4.2 Int越界问题
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -141,9 +142,9 @@ namespace Sunny.UI
string processText; string processText;
if (Direction == UILine.LineDirection.Horizontal) if (Direction == UILine.LineDirection.Horizontal)
processSize = posValue * Width * 1.0f / Maximum; processSize = posValue * 1.0f / Maximum * Width;
else else
processSize = posValue * Height * 1.0f / Maximum; processSize = posValue * 1.0f / Maximum * Height;
if (ShowPercent) if (ShowPercent)
processText = (posValue * 100.0 / maximum).ToString("F" + decimalCount) + "%"; processText = (posValue * 100.0 / maximum).ToString("F" + decimalCount) + "%";