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.
276 lines
6.5 KiB
C#
276 lines
6.5 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using Mesnac.Controls.Base;
|
|
using System;
|
|
using Mesnac.Controls.Default;
|
|
|
|
namespace Mesnac.Controls.Compressor
|
|
{
|
|
[ToolboxBitmap(typeof(System.Windows.Forms.Button))]
|
|
public partial class PictureButton : PLCButton, IPurviewControl
|
|
{
|
|
private List<DesignAction> _clickActionList = new List<DesignAction>();
|
|
private List<DesignAction> _keyDownActionList = new List<DesignAction>();
|
|
private List<DesignAction> _keyUpActionList = new List<DesignAction>();
|
|
private bool _mcVisible = true; //保存可见性
|
|
private bool _mcEnabled = true; //保存可用性
|
|
private bool _isValid = true; //保存有效性
|
|
private object _mcvalue;
|
|
private int _alarmvalue;//报警界限值
|
|
private string _nextpage;
|
|
private int _nextpagenum;
|
|
private int _writebit;
|
|
|
|
public PictureButton()
|
|
{
|
|
InitializeComponent();
|
|
|
|
WriteSelf = true;
|
|
}
|
|
|
|
public PictureButton(IContainer container)
|
|
{
|
|
container.Add(this);
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
|
|
public List<DesignAction> ClickActionList
|
|
{
|
|
get
|
|
{
|
|
return this._clickActionList;
|
|
}
|
|
set
|
|
{
|
|
this._clickActionList = value;
|
|
}
|
|
}
|
|
|
|
public List<DesignAction> KeyDownActionList
|
|
{
|
|
get { return _keyDownActionList; }
|
|
set { _keyDownActionList = value; }
|
|
}
|
|
|
|
public List<DesignAction> KeyUpActionList
|
|
{
|
|
get { return _keyUpActionList; }
|
|
set { _keyUpActionList = value; }
|
|
}
|
|
|
|
//业务
|
|
public string MCKey
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public object MCValue
|
|
{
|
|
get { return _mcvalue; }
|
|
set
|
|
{
|
|
int data = Convert.ToInt32(value);
|
|
if (data > 0)
|
|
{
|
|
this.Image = this.ImageNew;
|
|
}
|
|
else
|
|
{
|
|
this.Image = this.ImageOld;
|
|
}
|
|
}
|
|
}
|
|
|
|
//[Description("变化后图片"), Category("Picture")]
|
|
public Image ImageNew
|
|
{ get; set; }
|
|
//[Description("变化前图片"), Category("Picture")]
|
|
public Image ImageOld
|
|
{ get; set; }
|
|
|
|
public IBaseControl MCRoot
|
|
{
|
|
get
|
|
{
|
|
return null;
|
|
}
|
|
set
|
|
{
|
|
;
|
|
}
|
|
}
|
|
|
|
|
|
[TypeConverter(typeof(DataSourceConverter))]
|
|
|
|
[Description("数据连接"), Category("Data")]
|
|
public string MCDataSourceID
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public MCDataSource MCDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Description("是否为数据库控件"), Category("Data")]
|
|
public bool IsDbControl
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("初始化SQL"), Category("Data")]
|
|
public string InitDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("执行SQL"), Category("Data")]
|
|
public string ActionDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("绑定数据源"), Category("Data")]
|
|
public object BindDataSource
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
[Description("操作类型"), Category("Data")]
|
|
public DbOptionTypes DbOptionType
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[Description("是否可见"), Category("Behavior")]
|
|
public bool MCVisible
|
|
{
|
|
get
|
|
{
|
|
return this._mcVisible;
|
|
}
|
|
set
|
|
{
|
|
this._mcVisible = value == null ? true : value;
|
|
if (this.Site.DesignMode)
|
|
{
|
|
this.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
this.Visible = this._mcVisible;
|
|
}
|
|
}
|
|
}
|
|
[Description("是否可用"), Category("Behavior")]
|
|
public bool MCEnabled
|
|
{
|
|
get
|
|
{
|
|
return this._mcEnabled;
|
|
}
|
|
set
|
|
{
|
|
this._mcEnabled = value == null ? true : value;
|
|
if (this.Site.DesignMode)
|
|
{
|
|
this.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
this.Enabled = this._mcEnabled;
|
|
}
|
|
}
|
|
}
|
|
[Description("是否控制权限"), Category("Behavior")]
|
|
public bool MCPurview
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 报警界限值
|
|
/// </summary>
|
|
public int Alarmvalue
|
|
{
|
|
get { return _alarmvalue; }
|
|
set { _alarmvalue = value; }
|
|
}
|
|
|
|
//[Description("字其他位清零"), Category("PLC")]
|
|
//public bool Clear { get; set; }
|
|
|
|
///// <summary>
|
|
///// 跳转页面
|
|
///// </summary>
|
|
//public string NextPage
|
|
//{
|
|
// get { return _nextpage; }
|
|
// set { _nextpage = value; }
|
|
//}
|
|
|
|
///// <summary>
|
|
///// 跳转页面
|
|
///// </summary>
|
|
//public int NextPageNum
|
|
//{
|
|
// get { return _nextpagenum; }
|
|
// set { _nextpagenum = value; }
|
|
//}
|
|
|
|
////是否往自己本身绑定的PLC地址写
|
|
//public bool WriteSelf
|
|
//{
|
|
// get;
|
|
// set;
|
|
//}
|
|
|
|
////如果不往自己绑定的写,写入地址
|
|
//public string WriteAdress
|
|
//{
|
|
// get;
|
|
// set;
|
|
//}
|
|
|
|
////是否按位写入
|
|
//public bool WriteBybit
|
|
//{
|
|
// get;
|
|
// set;
|
|
//}
|
|
|
|
////写入位
|
|
//public int writebit
|
|
//{
|
|
// get { return _writebit; }
|
|
// set
|
|
// {
|
|
// if (value > 16)
|
|
// {
|
|
// _writebit = 0;
|
|
// }
|
|
// else
|
|
// {
|
|
// _writebit = value;
|
|
// }
|
|
// ;
|
|
// }
|
|
//}
|
|
public bool IsValid
|
|
{
|
|
get { return _isValid; }
|
|
set { _isValid = value; }
|
|
}
|
|
|
|
}
|
|
} |