using DevExpress.XtraLayout.Utils; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace ProductionSystem_UserControl.ExtendedControls { public partial class MyTestResultControl : UserControl { public MyTestResultControl() { InitializeComponent(); MaximumSize = new Size(236, 32); } #region 自定义属性 /// /// 参数名称 /// [Category("自定义属性"), Description("参数名称")] public string LblItemText { get { return lblItemDesc.Text; } set { lblItemDesc.Text = value; } } /// /// 是否显示测试结果 /// private bool _isShowTestResultTextEdit = true; [Category("自定义属性"), Description("是否显示测试结果")] public bool IsShowTestResultTextEdit { get { return layoutControlItem_TestResult.Visibility == LayoutVisibility.Always ? true : false; } set { _isShowTestResultTextEdit = value; if (_isShowTestResultTextEdit) { layoutControlItem_TestResult.Visibility = LayoutVisibility.Always; } else { layoutControlItem_TestResult.Visibility = LayoutVisibility.Never; } } } /// /// 测试结果 /// private string _testResultText = ""; [Category("自定义属性"), Description("测试结果")] public string TestResultText { get { return txtTestResult.Text; } set { _testResultText = value; txtTestResult.Text = _testResultText; } } /// /// 测试结果字体颜色 /// [Category("自定义属性"), Description("测试结果字体颜色")] public Color TestResultForeColor { get { return txtTestResult.ForeColor; } set { txtTestResult.ForeColor = value; } } /// /// 测试结果背景颜色 /// private Color _testResultBackColor = Color.Gainsboro; [Category("自定义属性"), Description("测试结果背景颜色")] public Color TestResultBackColor { get { return txtTestResult.BackColor; } set { _testResultBackColor = value; txtTestResult.BackColor = _testResultBackColor; } } /// /// 测试结果PLC点位编码 /// [Category("自定义属性"), Description("测试结果PLC点位编码")] public string TestResultPLCPointCode { get { return txtTestResult.Tag?.ToString(); } set { txtTestResult.Tag = value; } } /// /// 是否显示采集值 /// private bool _isShowTestValTextEdit = true; [Category("自定义属性"), Description("是否显示采集值")] public bool IsShowTestValTextEdit { get { return layoutControlItem_TestVal.Visibility == LayoutVisibility.Always ? true : false; } set { _isShowTestValTextEdit = value; if (_isShowTestValTextEdit) { layoutControlItem_TestVal.Visibility = LayoutVisibility.Always; } else { layoutControlItem_TestVal.Visibility = LayoutVisibility.Never; } } } /// /// 采集值 /// private string _testValText = ""; [Category("自定义属性"), Description("采集值")] public string TestValText { get { return txtTestVal.Text; } set { _testValText = value; txtTestVal.Text = _testValText; } } /// /// 采集值PLC点位编码 /// [Category("自定义属性"), Description("采集值PLC点位编码")] public string TestValPLCPointCode { get { return txtTestVal.Tag?.ToString(); } set { txtTestVal.Tag = value; } } #endregion } }