*UISwitch:增加是否只读属性

This commit is contained in:
Sunny 2022-01-02 20:28:38 +08:00
parent 1677fc631e
commit 70c160dcfb
3 changed files with 8 additions and 3 deletions

Binary file not shown.

View File

@ -54,8 +54,8 @@ namespace Sunny.UI.Demo
option.GreaterWarningArea = new UILineWarningArea(3.5); option.GreaterWarningArea = new UILineWarningArea(3.5);
option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold); option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = "上限", Value = 3.5 }); option.YAxisScaleLines.Add(new UIScaleLine("上限", 3.5, Color.Red));
option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "下限", Value = 2.2 }); option.YAxisScaleLines.Add(new UIScaleLine("下限", 2.2, Color.Gold));
option.XAxis.Name = "日期"; option.XAxis.Name = "日期";
option.YAxis.Name = "数值"; option.YAxis.Name = "数值";

View File

@ -20,6 +20,7 @@
* 2020-04-25: V2.2.4 * 2020-04-25: V2.2.4
* 2021-05-06: V3.0.3 Active状态改变时触发ValueChanged事件 * 2021-05-06: V3.0.3 Active状态改变时触发ValueChanged事件
* 2021-09-14: V3.0.7 Disabled颜色 * 2021-09-14: V3.0.7 Disabled颜色
* 2022-01-02: V3.0.9
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -59,6 +60,10 @@ namespace Sunny.UI
fillColor = Color.White; fillColor = Color.White;
} }
[DefaultValue(false)]
[Description("是否只读"), Category("SunnyUI")]
public bool ReadOnly { get; set; }
private UISwitchShape switchShape = UISwitchShape.Round; private UISwitchShape switchShape = UISwitchShape.Round;
[Description("开关形状"), Category("SunnyUI")] [Description("开关形状"), Category("SunnyUI")]
@ -173,7 +178,7 @@ namespace Sunny.UI
protected override void OnClick(EventArgs e) protected override void OnClick(EventArgs e)
{ {
Active = !Active; if (!ReadOnly) Active = !Active;
base.OnClick(e); base.OnClick(e);
} }