|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Controls.Default
|
|
|
|
|
{
|
|
|
|
|
[ToolboxBitmap(typeof(System.Windows.Forms.TextBox))]
|
|
|
|
|
public partial class TextBox : System.Windows.Forms.TextBox
|
|
|
|
|
{
|
|
|
|
|
public TextBox()
|
|
|
|
|
{
|
|
|
|
|
//this.DoubleBuffered = true;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
protected override void OnPaint(PaintEventArgs pe)
|
|
|
|
|
{
|
|
|
|
|
// TODO: 在此处添加自定义绘制代码
|
|
|
|
|
|
|
|
|
|
// 调用基类 OnPaint
|
|
|
|
|
base.OnPaint(pe);
|
|
|
|
|
}
|
|
|
|
|
#region bHaveAction
|
|
|
|
|
private bool _bHaveAction = false;
|
|
|
|
|
public bool bHaveAction
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _bHaveAction;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_bHaveAction = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region Text
|
|
|
|
|
private string _format = string.Empty;
|
|
|
|
|
public string Format
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _format;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_format = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private string _textName = null;
|
|
|
|
|
public string TextName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _textName;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_textName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private string _textValue = string.Empty;
|
|
|
|
|
public string TextValue
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._textValue = value;
|
|
|
|
|
if (!this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(this.Format))
|
|
|
|
|
{
|
|
|
|
|
this.Text = this._textValue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.Text = string.Format(this.Format, this._textValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._textValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region Left
|
|
|
|
|
private string _xName = null;
|
|
|
|
|
public string XName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _xName;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_xName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private int? _xValue = null;
|
|
|
|
|
public int? XValue
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._xValue = value;
|
|
|
|
|
if (!this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
if (this._xValue != null)
|
|
|
|
|
{
|
|
|
|
|
this.Left = (int)this._xValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._xValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region Top
|
|
|
|
|
private string _yName = null;
|
|
|
|
|
public string YName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _yName;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_yName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private int? _yValue = null;
|
|
|
|
|
public int? YValue
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._yValue = value;
|
|
|
|
|
if (!this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
if (this._yValue != null)
|
|
|
|
|
{
|
|
|
|
|
this.Top = (int)this._yValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._yValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region Width
|
|
|
|
|
private string _widthName = null;
|
|
|
|
|
public string WidthName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _widthName;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_widthName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private int? _widthValue = null;
|
|
|
|
|
public int? WidthValue
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._widthValue = value;
|
|
|
|
|
if (!this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
if (this._widthValue != null)
|
|
|
|
|
{
|
|
|
|
|
this.Width = (int)this._widthValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._widthValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region Height
|
|
|
|
|
private string _heightName = null;
|
|
|
|
|
public string HeightName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _heightName;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_heightName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private int? _heightValue = null;
|
|
|
|
|
public int? HeightValue
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._heightValue = value;
|
|
|
|
|
if (!this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
if (this._heightValue != null && !this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
this.Height = (int)this._heightValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._heightValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region Visible
|
|
|
|
|
//private string _visibleName = null;
|
|
|
|
|
//public string VisibleName
|
|
|
|
|
//{
|
|
|
|
|
// get
|
|
|
|
|
// {
|
|
|
|
|
// return _visibleName;
|
|
|
|
|
// }
|
|
|
|
|
// set
|
|
|
|
|
// {
|
|
|
|
|
// _visibleName = value;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//private int? _visibleValue = null;
|
|
|
|
|
//public int? VisibleValue
|
|
|
|
|
//{
|
|
|
|
|
// set
|
|
|
|
|
// {
|
|
|
|
|
// this._visibleValue = value;
|
|
|
|
|
// if (!this.DesignMode)
|
|
|
|
|
// {
|
|
|
|
|
// if (this._visibleValue != null)
|
|
|
|
|
// {
|
|
|
|
|
// this.Visible = ((int)this._visibleValue > 5);
|
|
|
|
|
// this.Refresh();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// get
|
|
|
|
|
// {
|
|
|
|
|
// return this._visibleValue;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
#region FillColor
|
|
|
|
|
private Color _newFillColor = Color.Red;
|
|
|
|
|
public Color NewFillColor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _newFillColor;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_newFillColor = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//原背景色
|
|
|
|
|
private Color _oldFillColor = Color.DarkGray;
|
|
|
|
|
public Color OldFillColor
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _oldFillColor;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_oldFillColor = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private string _fillColorName = null;
|
|
|
|
|
public string FillColorName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _fillColorName;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_fillColorName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int? _fillColorValue = null;
|
|
|
|
|
public int? FillColorValue
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._fillColorValue = value;
|
|
|
|
|
if (!this.DesignMode)
|
|
|
|
|
{
|
|
|
|
|
if (this._fillColorValue != null)
|
|
|
|
|
{
|
|
|
|
|
if ((int)this._fillColorValue > 0)
|
|
|
|
|
{
|
|
|
|
|
this.BackColor = this.NewFillColor;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.BackColor = this.OldFillColor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._fillColorValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|