* UIAnalogMeter: 增加ValueChanged事件

This commit is contained in:
Sunny 2021-08-18 09:27:35 +08:00
parent 9b38d5a32a
commit c112b98c66
6 changed files with 10 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -40,6 +40,8 @@ namespace Sunny.UI
/// Class for the analog meter control
/// </summary>
[ToolboxItem(true)]
[DefaultEvent("ValueChanged")]
[DefaultProperty("Value")]
public class UIAnalogMeter : UIControl
{
#region Enumerator
@ -186,6 +188,8 @@ namespace Sunny.UI
}
}
public event EventHandler ValueChanged;
[
Category("Behavior"),
Description("Value of the data"),
@ -203,8 +207,12 @@ namespace Sunny.UI
if (val < minValue)
val = minValue;
currValue = val;
Invalidate();
if (currValue != val)
{
currValue = val;
Invalidate();
ValueChanged?.Invoke(this, EventArgs.Empty);
}
}
}