收缩行
- if (this.dataGridView1.Columns[e.ColumnIndex].Name == "EX" && isEx == "true")
- {
- int RowCount = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells["RowCount"].Value);
- for (int i = 1; i <= RowCount; i++)
- {
- //隐藏行
- this.dataGridView1.Rows[e.RowIndex + i].Visible = false;
- }
- ////将IsEx设置为false,标明该节点已经收缩
- this.dataGridView1.Rows[e.RowIndex].Cells["IsEx"].Value = "false";
- this.dataGridView1.Rows[e.RowIndex].Cells["EX"].Value = "+";
- }
原文链接:http://www.cnblogs.com/Gyoung/archive/2012/05/04/2482392.html