using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace Mesnac.Controls.Sulf { [ToolboxBitmap(typeof(TextBox))] public partial class EquipPara : UserControl { public EquipPara() { InitializeComponent(); } private bool _isRead = true; /// /// 是否读取PLC /// public bool IsRead { get { return _isRead; } set { _isRead = value; } } private int _multiply; public int Multiply { get { return _multiply; } set { _multiply = value; } } private string _equipName; public string EquipName { get { return _equipName; } set { _equipName = value; } } public string EquipValue { set { if (!string.IsNullOrEmpty(value)) { int para = 0; int.TryParse(value,out para); if (_multiply != 0) this.label2.Text = (para * _multiply).ToString(); else this.label2.Text = value; if (_isRead) { this.textBox1.Text = this.label2.Text; this._isRead = false; } } } } private void label2_TextChanged(object sender, EventArgs e) { } private string _nameText; /// /// 名称 /// public string NameText { get { return _nameText; } set { _nameText = value; this.label1.Text = _nameText; } } private bool _isShowBtn; /// /// 是否显示按钮 /// public bool IsShowBtn { get { return _isShowBtn; } set { _isShowBtn = value; this.button1.Visible = _isShowBtn; } } private bool _isShowName; /// /// 是否现实标题 /// public bool IsShowName { get { return _isShowName; } set { _isShowName = value; this.label1.Visible = _isShowName; } } private string _textValue; /// /// 文本值 /// public string TextValue { get { return this.textBox1.Text; } set { this.textBox1.Text = value; } } private void button1_Click(object sender, EventArgs e) { NumberControl mun = new NumberControl(); if (mun.ShowDialog() == DialogResult.OK) { this.TextValue = mun.textBox1.Text; } mun.Close(); //if (this.TextValue == "1") // this.TextValue = "0"; //else // this.TextValue = "1"; } } }