private void Form1_Load(object sender, EventArgs e)
ht = new Hashtable();
ht.Add(1, true);
ht.Add(2, true);//父节点1,2处于展开状态
//添加测试行
dataGridView1.Rows.Add(10, 1);
dataGridView1.Rows.Add(11, 1);
dataGridView1.Rows.Add(12, 1);
dataGridView1.Rows.Add(2, 0);
dataGridView1.Rows.Add(20, 2);
dataGridView1.Rows.Add(21, 2);
dataGridView1.Rows.Add(22, 2);
}
Hashtable ht;//存储父节点状态
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
if ((int)dataGridView1.Rows[e.RowIndex].Cells[1].Value == 0)//当前行为父节点时绘制图标
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location