BooleanObject.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using PaintDotNet.Base;
  2. using PaintDotNet.CustomControl;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Windows.Forms;
  6. namespace PaintDotNet.Data.Param
  7. {
  8. /// <summary>
  9. /// 布尔类型,针对脚本目前设计有两种状态
  10. /// 1、Lists下有数据,则不铺UI,继续进行循环
  11. /// 2、Lists下没有数据,则铺一个是否的下拉
  12. /// </summary>
  13. public class BooleanObject : Args
  14. {
  15. public void Boolean_ValueChanged(object sender, EventArgs e)
  16. {
  17. if (sender.GetType() == typeof(Button))
  18. {
  19. if (((Button)sender).Text == "反选")
  20. {
  21. this.Value = false;
  22. }
  23. else//取消反选
  24. {
  25. this.Value = true;
  26. }
  27. //}
  28. //else if (sender.GetType() == typeof(NumericUpDown))
  29. //{
  30. // this.Value = (int)((NumericUpDown)sender).Value;
  31. }
  32. else if (sender.GetType() == typeof(ComboBox))
  33. {
  34. if (((ComboBox)sender).SelectedIndex == 1)
  35. this.Value = false;
  36. else
  37. this.Value = true;
  38. }
  39. }
  40. public void CheckBox_ValueChanged(object sender, EventArgs e)
  41. {
  42. if (sender.GetType() == typeof(CheckBox))
  43. {
  44. this.Value = ((CheckBox)sender).Checked;
  45. }
  46. }
  47. public BooleanObject(string key, string name, Args[] arr)
  48. {
  49. this.Type = Dtryt.Boolean;
  50. this.key = key;
  51. this.name = name;
  52. this.initialValue = false;
  53. this.value = false;
  54. if (arr!=null)
  55. {
  56. this.Lists = new List<Args>(arr);
  57. }
  58. }
  59. public BooleanObject(string key, string name, object value, Args[] arr)
  60. {
  61. this.Type = Dtryt.Boolean;
  62. this.key = key;
  63. this.name = name;
  64. this.initialValue = value;
  65. this.value = value;
  66. if (arr != null)
  67. {
  68. this.Lists = new List<Args>(arr);
  69. }
  70. }
  71. public BooleanObject()
  72. {
  73. this.Type = Dtryt.Boolean;
  74. }
  75. }
  76. }