using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Text; namespace LYFZ.ComponentLibrary { public partial class NumericUpDownEx : LYFZ.OtherExpansion.SkinControl.SkinNumericUpDown//System.Windows.Forms.NumericUpDown { public NumericUpDownEx() { InitializeComponent(); this.KeyUp += NumericUpDownEx_KeyUp; } void NumericUpDownEx_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.Delete || e.KeyCode == System.Windows.Forms.Keys.Back) { try { if (this.Text.Trim().Length <= 0) { this.Text = "0"; this.Value = 0; } } catch { this.Text = this.Minimum.ToString(); this.Value = this.Minimum; } } } public NumericUpDownEx(IContainer container) { container.Add(this); this.KeyUp += NumericUpDownEx_KeyUp; } } }