25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.6 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace StuMgmClient
  9. {
  10. public partial class StudentTree : UserControl
  11. {
  12. public StudentTree()
  13. {
  14. InitializeComponent();
  15. }
  16. ////个人信息
  17. //private DataSet ds = null;
  18. //public DataSet Ds
  19. //{
  20. // get { return ds; }
  21. // set { ds = value; }
  22. //}
  23. ////节点table
  24. //DataTable table = null;
  25. ////dataRows转化成的table
  26. //DataTable tableClone = null;
  27. //Data da = new Data();
  28. //private void StudentTree_Load(object sender, EventArgs e)
  29. //{
  30. // dgvStudent.Visible = false;
  31. // BindRoot();
  32. // //da.GetNodesDic(table);
  33. //}
  34. private void StudentTree_Load(object sender, EventArgs e) { }
  35. ////添加父节点的方法
  36. //private void BindRoot()
  37. //{
  38. // //ClientMysql cm = new ClientMysql();
  39. // // DataSet ds = cm.SelectNode();
  40. // table = Ds.Tables["course_info"];
  41. // //把父节点的数据帅选出来
  42. // DataRow[] rows = table.Select("pid=0");//取根
  43. // foreach (DataRow dRow in rows)
  44. // {
  45. // TreeNode rootNode = new TreeNode();
  46. // rootNode.Tag = dRow;
  47. // rootNode.Text = dRow["name"].ToString();
  48. // //把此节点放入树中
  49. // StudenTree.Nodes.Add(rootNode);
  50. // //绑定子节点
  51. // BindChildAreas(rootNode);//调用添加子节点的方法
  52. // }
  53. //}
  54. ////添加子节点的方法、递归绑定子区域
  55. //private void BindChildAreas(TreeNode fNode)
  56. //{
  57. // DataRow dr = (DataRow)fNode.Tag;//父节点数据关联的数据行
  58. // int fAreaId = Convert.ToInt32(dr["id"]); //父节点ID
  59. // DataRow[] rows1 = table.Select("pid =" + fAreaId);//子区域
  60. // if (rows1.Length == 0) //递归终止,区域不包含子区域时
  61. // {
  62. // return;
  63. // }
  64. // foreach (DataRow dRow in rows1)
  65. // {
  66. // TreeNode node = new TreeNode();
  67. // node.Tag = dRow;
  68. // node.Text = dRow["name"].ToString();
  69. // //添加子节点
  70. // fNode.Nodes.Add(node);
  71. // }
  72. //}
  73. ////子节点单击显示内容
  74. //private void StudentTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  75. private void StudentTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { }
  76. //{
  77. // if (e.Button == System.Windows.Forms.MouseButtons.Left) //单击鼠标左键才响应
  78. // {
  79. // if (e.Node.Level == 1) //判断子节点才响应
  80. // {
  81. // dgvStudent.Visible = true;
  82. // DataRow dr = (DataRow)e.Node.Tag;
  83. // int fAreaId = Convert.ToInt32(dr["id"]); //子节点ID
  84. // DataRow[] drows = table.Select("pid =" + fAreaId);//取根
  85. // tableClone = table.Clone();//克隆表结构
  86. // foreach (DataRow drr in drows)
  87. // {
  88. // tableClone.ImportRow(drr);
  89. // }
  90. // dgvStudent.AutoGenerateColumns = false;
  91. // dgvStudent.AllowUserToAddRows = false;
  92. // dgvStudent.DataSource = tableClone;
  93. // }
  94. // }
  95. //}
  96. private void DgvStudent_CellContentClick(object sender, DataGridViewCellEventArgs e)
  97. { }
  98. ////我的任务_查看按钮方法
  99. //private void DgvStudent_CellContentClick(object sender, DataGridViewCellEventArgs e)
  100. //{
  101. // if (e.ColumnIndex == 1 && e.RowIndex != -1)
  102. // {
  103. // //Dictionary<int, int> stateDic = da.StateParsing(table);
  104. // Dictionary<int, int> stateDic = da.GetNodesDic(table);
  105. // // string s=da.DicParsing(stateDic);
  106. // DataRow drViews = tableClone.Rows[e.RowIndex];
  107. // int state = stateDic[Convert.ToInt32((drViews["id"]))];
  108. // SelectFrom sf = new SelectFrom(drViews, state);
  109. // //string test = da.DicParsing(stateDic);
  110. // sf.ShowDialog();
  111. // // ShowData();
  112. // }
  113. //}
  114. }
  115. }