using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace JYControl { public partial class IO_Instructions : UserControl { public IO_Instructions() { InitializeComponent(); } public int IO_Value; public string mstrCaption = ""; public string mstrText = "输入描述"; public bool Reversal, GreenOrRed; [Category("jason控件属性")] [Description("是否开启反转")] public bool AAReversal { get { return Reversal; } set { Reversal = value; } } [Category("jason控件属性")] [Description("颜色变更绿色或者红色")] public bool AAGreenOrRed { get { return GreenOrRed; } set { GreenOrRed = value; } } [Category("jason控件属性")] [Description("控件名称")] public string AAName { get { return mstrCaption; } set { mstrCaption = value; } } [Category("jason控件属性")] [Description("控件描述")] public string AAText { get { return mstrText; } set { mstrText = value; LabelX.Text = AAText; } } [Category("jason控件属性")] [Description("控件IO值")] public int AAValue { get { return IO_Value; } set { IO_Value = value; if (value == 1) { if (Reversal) { if (GreenOrRed) { ledControl.LedTrueColor = Color.Red; } else { ledControl.LedTrueColor = Color.Green; } } else { if (GreenOrRed) { ledControl.LedTrueColor = Color.Transparent; } else { ledControl.LedTrueColor = Color.Lime; } } } else { if (Reversal) { if (GreenOrRed) { ledControl.LedTrueColor = Color.Lime; } else { ledControl.LedTrueColor = Color.Red; } } else { if (GreenOrRed) { ledControl.LedTrueColor = Color.Red; } else { ledControl.LedTrueColor = Color.Transparent; } } } } } } }