IntegerNumber.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 IntegerNumber : Args
  12. {
  13. private int min;
  14. private int max;
  15. public void numberParam_ValueChanged(object sender, EventArgs e)
  16. {
  17. if (sender.GetType() == typeof(NumberParamControl)) {
  18. this.Value = ((NumberParamControl)sender).Value;
  19. } else if (sender.GetType() == typeof(NumericUpDown))
  20. {
  21. this.Value = (int)((NumericUpDown)sender).Value;
  22. }
  23. }
  24. public IntegerNumber(int min, int max)
  25. {
  26. this.Type = Dtryt.Interger;
  27. this.min = min;
  28. this.max = max;
  29. }
  30. public IntegerNumber(string key, string name)
  31. {
  32. this.Type = Dtryt.Interger;
  33. this.key = key;
  34. this.name = name;
  35. }
  36. public IntegerNumber(int min, int max, int initialValue, string key, string name)
  37. {
  38. this.Type = Dtryt.Interger;
  39. this.min = min;
  40. this.max = max;
  41. this.initialValue = initialValue;
  42. this.value = initialValue;
  43. this.key = key;
  44. this.name = name;
  45. }
  46. public int Min
  47. {
  48. get
  49. {
  50. return this.min;
  51. }
  52. set
  53. {
  54. this.min = value;
  55. }
  56. }
  57. public int Max
  58. {
  59. get
  60. {
  61. return this.max;
  62. }
  63. set
  64. {
  65. this.max = value;
  66. }
  67. }
  68. }
  69. }