コード例 #1
0
 public override void HandleInput(PointF relativeMousePos)
 {
     if (_active)
     {
         var num = InputState.AnyNumberKeyPressed();
         if (num >= '0' && num <= '9')
         {
             _value += num;
             NotifyChanged();
         }
         else if (num == '-' && _value.Length == 0)
         {
             _value = "-";
         }
         else if (!IsInteger && num == '.' && _value.Length > 0 && !_value.Contains('.'))
         {
             _value += '.';
         }
         else if (InputState.KeyPressed(Key.BackSpace, true) && _value.Length > 0)
         {
             _value = _value.Substring(0, _value.Length - 1);
             NotifyChanged();
         }
         else if (InputState.KeyPressed(Key.Up, true))
         {
             Value = Value + Increment;
             NotifyChanged();
         }
         else if (InputState.KeyPressed(Key.Down, true))
         {
             Value = Value - Increment;
             NotifyChanged();
         }
         else if (InputState.MouseWheelChange() != 0)
         {
             Value = Value + (InputState.MouseWheelChange() * Increment);
             NotifyChanged();
         }
     }
     if (InputState.MouseButtonPressed(MouseButton.Left))
     {
         _active = _clickRegion.Contains(relativeMousePos);
     }
 }