You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB
C#

using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace ProductionSystem_UserControl.ExtendedControls
{
public partial class MyResultControl : UserControl
{
public MyResultControl()
{
InitializeComponent();
MaximumSize = new Size(93, 28);
}
#region 自定义属性
/// <summary>
/// 参数名称
/// </summary>
[Category("自定义属性"), Description("参数名称")]
public string LblItemText
{
get { return lblItemDesc.Text; }
set { lblItemDesc.Text = value; }
}
/// <summary>
/// 采集值
/// </summary>
private string _testValText = "";
[Category("自定义属性"), Description("采集值")]
public string TestValText
{
get { return txtTestVal.Text; }
set
{
if (txtTestVal.Text == "停止")
{
txtTestVal.ForeColor = Color.Red;
}else if(txtTestVal.Text == "启动")
{
txtTestVal.ForeColor = Color.Green;
}
_testValText = value;
txtTestVal.Text = _testValText;
}
}
//添加背景颜色
/// <summary>
/// 采集值PLC点位编码
/// </summary>
[Category("自定义属性"), Description("采集值PLC点位编码")]
public string TestValPLCPointCode
{
get { return txtTestVal.Tag?.ToString(); }
set { txtTestVal.Tag = value; }
}
#endregion
}
}