Category.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. Hashtable table;
  24. public Category(List<string> a_ElementList, List<string> AllList)
  25. {
  26. InitializeComponent();
  27. ElementList = AllList;
  28. CheckTheOptions = a_ElementList;
  29. OutElementList = a_ElementList;
  30. #region 国际化语言
  31. OTSCommon.Language lan = new OTSCommon.Language(this);
  32. table = lan.GetNameTable(this.Name);
  33. #endregion
  34. }
  35. private void Category_Load(object sender, EventArgs e)
  36. {
  37. for (int i = 0; i < ElementList.Count; i++)
  38. {
  39. checkedListBox1.Items.Add(ElementList[i]);
  40. }
  41. for (int i = 0; i < checkedListBox1.Items.Count; i++)
  42. {
  43. if (CheckTheOptions.Count == 0)
  44. {
  45. checkedListBox1.SetItemChecked(i, true);
  46. }
  47. else
  48. {
  49. for (int a = 0; a < CheckTheOptions.Count; a++)
  50. {
  51. if (checkedListBox1.Items[i].ToString() == CheckTheOptions[a].ToString())
  52. checkedListBox1.SetItemChecked(i, true);
  53. }
  54. }
  55. }
  56. }
  57. /// <summary>
  58. /// 确定按钮
  59. /// </summary>
  60. /// <param name="sender"></param>
  61. /// <param name="e"></param>
  62. private void button3_Click(object sender, EventArgs e)
  63. {
  64. OutElementList.Clear();
  65. for (int i=0;i< checkedListBox1.Items.Count;i++)
  66. {
  67. if (checkedListBox1.GetItemChecked(i))
  68. {
  69. OutElementList.Add(checkedListBox1.Items[i].ToString());
  70. }
  71. }
  72. IsModify = true;
  73. this.Close();
  74. }
  75. /// <summary>
  76. /// 取消按钮
  77. /// </summary>
  78. /// <param name="sender"></param>
  79. /// <param name="e"></param>
  80. private void button4_Click(object sender, EventArgs e)
  81. {
  82. this.Close();
  83. }
  84. }
  85. }