DecimalNumber.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using PaintDotNet.Base;
  2. using PaintDotNet.CustomControl;
  3. using System;
  4. using System.Windows.Forms;
  5. namespace PaintDotNet.Data.Param
  6. {
  7. /// <summary>
  8. /// 小数范围
  9. /// </summary>
  10. public class DecimalNumber : Args
  11. {
  12. private int decimalPlaces;
  13. private decimal min;
  14. private decimal max;
  15. public void numberParam_ValueChanged(object sender, EventArgs e)
  16. {
  17. if (sender.GetType() == typeof(NumberParamControl))
  18. {
  19. this.Value = ((NumberParamControl)sender).Value;
  20. }
  21. else if (sender.GetType() == typeof(NumericUpDown))
  22. {
  23. this.Value = ((NumericUpDown)sender).Value;
  24. }
  25. }
  26. public DecimalNumber(decimal min, int max)
  27. {
  28. this.Type = Dtryt.Decimal;
  29. this.decimalPlaces = 0;
  30. this.min = min;
  31. this.max = max;
  32. }
  33. /// <summary>
  34. /// 十进制位数
  35. /// </summary>
  36. public int DecimalPlaces
  37. {
  38. get
  39. {
  40. return this.decimalPlaces;
  41. }
  42. set
  43. {
  44. this.decimalPlaces = value;
  45. }
  46. }
  47. public decimal Min
  48. {
  49. get
  50. {
  51. return this.min;
  52. }
  53. set
  54. {
  55. this.min = value;
  56. }
  57. }
  58. public decimal Max
  59. {
  60. get
  61. {
  62. return this.max;
  63. }
  64. set
  65. {
  66. this.max = value;
  67. }
  68. }
  69. }
  70. }