DecimalNumber.cs 1.7 KB

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