|
|
|
|
using Mesnac.Controls.Base;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Controls.Default
|
|
|
|
|
{
|
|
|
|
|
[ToolboxBitmap(typeof(ProgressBar))]
|
|
|
|
|
public partial class XProgressBar : ProgressBar, IBaseControl
|
|
|
|
|
{
|
|
|
|
|
#region 字段定义
|
|
|
|
|
|
|
|
|
|
private bool _mcVisible = true; //保存可见性
|
|
|
|
|
private bool _mcEnabled = true; //保存可用性
|
|
|
|
|
private bool _isValid = true; //保存有效性
|
|
|
|
|
private bool _isEventValid = true; //保存事件有效性
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 构造方法
|
|
|
|
|
|
|
|
|
|
public XProgressBar()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
public string MaxName { get; set; }
|
|
|
|
|
public string ValName { get; set; }
|
|
|
|
|
protected override CreateParams CreateParams
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
CreateParams cp = base.CreateParams;
|
|
|
|
|
cp.Style |= 0x04;
|
|
|
|
|
return cp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public int MaxNumValue
|
|
|
|
|
{
|
|
|
|
|
get => Maximum;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Maximum = value;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Val
|
|
|
|
|
{
|
|
|
|
|
get => Value;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value > MaxNumValue)
|
|
|
|
|
{
|
|
|
|
|
Value = MaxNumValue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Value = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public XProgressBar(IContainer container)
|
|
|
|
|
{
|
|
|
|
|
container.Add(this);
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 接口成员实现
|
|
|
|
|
|
|
|
|
|
public string MCKey
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object XValue
|
|
|
|
|
{
|
|
|
|
|
get { return this.Value; }
|
|
|
|
|
set { this.Value = value == null ? 0 : Convert.ToInt32(value.ToString()); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object MCValue
|
|
|
|
|
{
|
|
|
|
|
get { return this.Value; }
|
|
|
|
|
set { this.Value = value == null ? 0 : Convert.ToInt32(value.ToString()); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IBaseControl MCRoot
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsValid
|
|
|
|
|
{
|
|
|
|
|
get { return _isValid; }
|
|
|
|
|
set { _isValid = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsEventValid
|
|
|
|
|
{
|
|
|
|
|
get { return this._isEventValid; }
|
|
|
|
|
set { this._isEventValid = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|