NumericUpDown.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.ComponentModel;
  2. namespace System.Windows.Forms
  3. {
  4. public class NumericUpDown : Control, ISupportInitialize
  5. {
  6. protected new CustomControls.NumericUpDown control { get; }
  7. public decimal Value
  8. {
  9. get => control.Value;
  10. set => control.Value = value;
  11. }
  12. public decimal Minimum
  13. {
  14. get => control.Minimum;
  15. set => control.Minimum = value;
  16. }
  17. public decimal Maximum
  18. {
  19. get => control.Maximum;
  20. set => control.Maximum = value;
  21. }
  22. public decimal Increment
  23. {
  24. get => control.Increment;
  25. set => control.Increment = value;
  26. }
  27. public int DecimalPlaces
  28. {
  29. get => control.DecimalPlaces;
  30. set => control.DecimalPlaces = value;
  31. }
  32. public bool ThousandsSeparator { get; set; } // TODO?
  33. public bool Hexadecimal { get; set; } // TODO?
  34. public HorizontalAlignment TextAlign { get; set; } // TODO?
  35. public event EventHandler ValueChanged;
  36. protected override void SetControlHeight(int value)
  37. {
  38. // height is controlled by textbox part
  39. }
  40. public void BeginInit() { }
  41. public void EndInit() { }
  42. public NumericUpDown()
  43. {
  44. control = new();
  45. SetControl(control);
  46. control.ValueChanged += (sender, args) => ValueChanged?.Invoke(this, EventArgs.Empty);
  47. Height = 22;
  48. }
  49. }
  50. }