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 Infragistics.Win.UltraWinEditors; namespace Core.Mes.Client.Comm.Control { public partial class LabelNumericText : UserControl, LabelControlInterface { public LabelNumericText() { InitializeComponent(); } [Browsable(true), Category("原始控件")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public Label Label { get { return this.label1; } } [Browsable(true), Category("原始控件")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public UltraNumericEditor UltraNumbericEditor { get { return this.ultraNumericEditor1; } } [Browsable(true), Category("原始系统控件")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public CheckBox CheckBox { get { return this.checkBox1; } } [Browsable(true), Category("外观")] [TypeConverter(typeof(StringConverter))] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public object Value { get { return this.ultraNumericEditor1.Value; } set { if (value == DBNull.Value) { this.ultraNumericEditor1.Value = null; ultraNumericEditor1.Refresh(); } else { this.ultraNumericEditor1.Value = value; } } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public string Caption { get { return this.label1.Text; } set { this.label1.Text = value; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public bool CheckBoxVisible { get { return this.checkBox1.Visible; } set { this.checkBox1.Visible = value; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public bool Checked { get { return this.checkBox1.Checked; } set { this.checkBox1.Checked = value; } } [Browsable(true), Category("外观")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public bool NumericEnabled { get { return this.ultraNumericEditor1.Enabled; } set { this.ultraNumericEditor1.Enabled = value; } } [Browsable(true), Category("行为")] [TypeConverter(typeof(StringConverter))] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public object MaxValue { get { return this.ultraNumericEditor1.MaxValue; } set { this.ultraNumericEditor1.MaxValue = value; } } [Browsable(true), Category("行为")] [TypeConverter(typeof(StringConverter))] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public object MinValue { get { return this.ultraNumericEditor1.MinValue; } set { this.ultraNumericEditor1.MinValue = value; } } [Browsable(true), Category("行为")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public NumericType NumericType { get { return this.ultraNumericEditor1.NumericType; } set { this.ultraNumericEditor1.NumericType = value; } } [Browsable(true), Category("行为")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public bool Nullable { get { return this.ultraNumericEditor1.Nullable; } set { this.ultraNumericEditor1.Nullable = value; } } private void checkBox1_VisibleChanged(object sender, EventArgs e) { if (checkBox1.Visible == false) { label1.Location = checkBox1.Location; this.checkBox1.Checked = true; } else { int x = checkBox1.Location.X + checkBox1.Size.Width + 2; label1.Location = new Point(x, checkBox1.Location.Y); } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { this.ultraNumericEditor1.Enabled = checkBox1.Checked; } private void ultraNumericEditor1_ValueChanged_1(object sender, EventArgs e) { if (DataBindings["Value"] != null) { DataBindings["Value"].WriteValue(); } } private void label1_MouseClick(object sender, MouseEventArgs e) { if (checkBox1.Visible == true) { checkBox1.Checked = !checkBox1.Checked; } } } }