Category.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using SourceGrid;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace OTSIncAReportApp._1_UI.OTSReportExport
  13. {
  14. public partial class Category : Form
  15. {
  16. List<string> CheckTheOptions = new List<string>();
  17. List<string> ElementList = new List<string>();
  18. public List<string> OutElementList = new List<string>();
  19. /// <summary>
  20. /// 窗体是否修改
  21. /// </summary>
  22. public bool IsModify = false;
  23. public List<string> vs = new List<string>();
  24. Hashtable table;
  25. public Category(List<string> a_ElementList, List<string> AllList)
  26. {
  27. InitializeComponent();
  28. ElementList = AllList;
  29. CheckTheOptions = a_ElementList;
  30. OutElementList = a_ElementList;
  31. #region 国际化语言
  32. OTSCommon.Language lan = new OTSCommon.Language(this);
  33. table = lan.GetNameTable(this.Name);
  34. #endregion
  35. }
  36. private void Category_Load(object sender, EventArgs e)
  37. {
  38. for (int i = 0; i < ElementList.Count; i++)
  39. {
  40. checkedListBox1.Items.Add(ElementList[i]);
  41. }
  42. for (int i = 0; i < checkedListBox1.Items.Count; i++)
  43. {
  44. if (CheckTheOptions.Count == 0)
  45. {
  46. checkedListBox1.SetItemChecked(i, true);
  47. }
  48. else
  49. {
  50. for (int a = 0; a < CheckTheOptions.Count; a++)
  51. {
  52. if (checkedListBox1.Items[i].ToString() == CheckTheOptions[a].ToString())
  53. checkedListBox1.SetItemChecked(i, true);
  54. }
  55. }
  56. }
  57. }
  58. /// <summary>
  59. /// 确定按钮
  60. /// </summary>
  61. /// <param name="sender"></param>
  62. /// <param name="e"></param>
  63. private void button3_Click(object sender, EventArgs e)
  64. {
  65. OutElementList.Clear();
  66. for (int i=0;i< checkedListBox1.Items.Count;i++)
  67. {
  68. if (checkedListBox1.GetItemChecked(i))
  69. {
  70. OutElementList.Add(checkedListBox1.Items[i].ToString());
  71. vs.Add("1");
  72. }
  73. else
  74. {
  75. vs.Add("0");
  76. }
  77. }
  78. IsModify = true;
  79. this.Close();
  80. }
  81. /// <summary>
  82. /// 取消按钮
  83. /// </summary>
  84. /// <param name="sender"></param>
  85. /// <param name="e"></param>
  86. private void button4_Click(object sender, EventArgs e)
  87. {
  88. this.Close();
  89. }
  90. }
  91. }