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