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.
138 lines
3.3 KiB
C#
138 lines
3.3 KiB
C#
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;
|
|
/// <summary>
|
|
/// 是否读取PLC
|
|
/// </summary>
|
|
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;
|
|
/// <summary>
|
|
/// 名称
|
|
/// </summary>
|
|
public string NameText
|
|
{
|
|
get { return _nameText; }
|
|
set
|
|
{
|
|
_nameText = value;
|
|
this.label1.Text = _nameText;
|
|
}
|
|
}
|
|
|
|
private bool _isShowBtn;
|
|
/// <summary>
|
|
/// 是否显示按钮
|
|
/// </summary>
|
|
public bool IsShowBtn
|
|
{
|
|
get { return _isShowBtn; }
|
|
set
|
|
{
|
|
_isShowBtn = value;
|
|
this.button1.Visible = _isShowBtn;
|
|
}
|
|
}
|
|
|
|
private bool _isShowName;
|
|
/// <summary>
|
|
/// 是否现实标题
|
|
/// </summary>
|
|
public bool IsShowName
|
|
{
|
|
get { return _isShowName; }
|
|
set
|
|
{
|
|
_isShowName = value;
|
|
this.label1.Visible = _isShowName;
|
|
}
|
|
}
|
|
|
|
private string _textValue;
|
|
/// <summary>
|
|
/// 文本值
|
|
/// </summary>
|
|
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";
|
|
}
|
|
}
|
|
}
|