示例#1
0
 public NumericStepperHandler()
 {
     Control = new EtoNumericUpDown
     {
         Handler = this,
         Maximum = DoubleToDecimal(double.MaxValue),
         Minimum = DoubleToDecimal(double.MinValue),
         Width   = 80
     };
     Control.ValueChanged += Control_ValueChanged;
     Control.LostFocus    += (sender, e) =>
     {
         // ensure value is always shown
         if (string.IsNullOrEmpty(Control.Text))
         {
             Control.Value = (decimal)Math.Round(Math.Max(MinValue, Math.Min(MaxValue, 0)), DecimalPlaces);
             Control.UpdateText();
         }
     };
 }
示例#2
0
 public NumericUpDownHandler()
 {
     Control = new EtoNumericUpDown
     {
         Maximum = decimal.MaxValue,
         Minimum = decimal.MinValue,
         Width   = 80
     };
     Control.ValueChanged += (sender, e) =>
     {
         UpdateRequiredDigits();
         Callback.OnValueChanged(Widget, EventArgs.Empty);
     };
     Control.LostFocus += (sender, e) =>
     {
         // ensure value is always shown
         if (string.IsNullOrEmpty(Control.Text))
         {
             Control.Text = Math.Round(Math.Max(MinValue, Math.Min(MaxValue, 0)), DecimalPlaces).ToString();
         }
     };
 }