IntegerNumber.cs 1.7 KB

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