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;
using DevExpress.XtraEditors;
using Lskj.Business.Impl;
namespace Lskj.Control
{
public partial class LabelIntExtendEdit : BaseUserControl
{
public string editValue;
///
/// 文本控件
///
public TextEdit TextEdit { get { return txtEdit; } }
public LabelIntExtendEdit()
{
InitializeComponent();
}
///
/// 说明:设置控件显示文本
/// 创建人:龚宇超
/// 创建日期:2017-08-07
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// 显示Lebel文本
public override string LabelText
{
get
{
return this.Model.Text;
}
set
{
if (FontSize > 0)
{
this.txtEdit.Properties.AutoHeight = false;
this.simpleButton1.Width = this.simpleButton2.Width = this.simpleButton3.Width = this.simpleButton4.Width = this.simpleButton5.Width = this.simpleButton6.Width = this.Model.Size.Height;
}
}
}
///
/// 字体大小
///
/// The size of the control.
public override float FontSize
{
get
{
return base.FontSize;
}
set
{
base.FontSize = value;
if (value > 0)
{
this.TextEdit.Font = new Font(this.TextEdit.Font.FontFamily, value);
}
}
}
///
/// 说明:设置控件值
/// 创建人:龚宇超
/// 创建日期:2017-08-07
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
public override string EditText
{
get
{
return this.txtEdit.Text;
}
set
{
this.txtEdit.Text = ReturnValue(value) + "";
}
}
///
/// 获取隐藏值
///
/// The edit value.
public string EditValue
{
get
{
return editValue;
}
}
///
/// 说明:设置控件提示文本
/// 创建人:龚宇超
/// 创建日期:2017-08-07
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// 返回控件值
public override string NullText
{
get
{
return this.txtEdit.Properties.NullValuePrompt;
}
set
{
if (!string.IsNullOrEmpty(value))
{
this.TextEdit.Properties.NullValuePromptShowForEmptyValue = true;
this.TextEdit.Properties.NullValuePrompt = value;
}
base.NullText = value;
}
}
///
/// 只读文本颜色
///
/// The color of the read only label.
public override bool ReadOnly
{
get
{
return base.ReadOnly;
}
set
{
base.ReadOnly = value;
this.txtEdit.Properties.ReadOnly = value;
}
}
///
/// 必填文本颜色
///
/// The color of the required label.
public override bool Required
{
get
{
return base.Required;
}
set
{
base.Required = value;
}
}
public int ReturnValue(string value)
{
int iValue = 0;
if (Int32.TryParse(value, out iValue))
{
return Convert.ToInt32(value);
}
return iValue;
}
private void simpleButton1_Click_1(object sender, EventArgs e)
{
try
{
this.txtEdit.Text = ReturnValue(this.Model.DefaultValue) + "";
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
try
{
this.txtEdit.Text = (ReturnValue(this.txtEdit.Text) - 10) + "";
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
private void simpleButton3_Click(object sender, EventArgs e)
{
try
{
this.txtEdit.Text = (ReturnValue(this.txtEdit.Text) - 1) + "";
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
private void simpleButton4_Click(object sender, EventArgs e)
{
try
{
this.txtEdit.Text = (ReturnValue(this.txtEdit.Text) + 1) + "";
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message,ex.Message);
}
}
private void simpleButton5_Click(object sender, EventArgs e)
{
try
{
this.txtEdit.Text = (ReturnValue(this.txtEdit.Text) + 10) + "";
}
catch (E