/// <summary>
 /// 删除集合除首条外的所有子条目
 /// </summary>
 /// <param name="row">折叠行对象</param>
 /// <param name="flag"></param>
 private void RemoveAllSubRow(CollDataGridViewRow row, bool flag)
 {
     if (row.Rows.Count != 0)
     {
         if (!row.IsCollapse)
         {
             for (int i = 0; i < row.Rows.Count; i++)
             {
                 if (row.Rows[i] is CollDataGridViewRow)
                 {
                     RemoveAllSubRow((CollDataGridViewRow)row.Rows[i], true);
                 }
                 else
                 {
                     this.Rows.Remove(row.Rows[i]);
                 }
             }
         }
         if (flag)
         {
             row.IsCollapse = true;
             this.Rows.Remove(row);
         }
     }
 }
        public void AddData(JArray array, int ignoreIndex, int childNum)
        {
            foreach (var item in array)
            {
                var childList = new List <JObject>();
                for (int i = 0; i < childNum; i++)
                {
                    childList.Add((JObject)item);
                }

                CollDataGridViewRow collapseRow = new CollDataGridViewRow();
                collapseRow.IsCollapse = true;
                collapseRow.GroupTag   = childList;

                DataGridViewCheckBoxCell cell = new DataGridViewCheckBoxCell();
                cell.Value = false;
                collapseRow.Cells.Add(cell);//不预先添加则无法折叠--相当于插入了空行

                for (int i = 1; i < childNum + 1; i++)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    cell       = new DataGridViewCheckBoxCell();
                    cell.Value = false;
                    row.Cells.Add(cell);//不预先添加则无法折叠
                    collapseRow.Rows.Add(row);
                }

                var rownum = this.Rows.Add(collapseRow);
                this.Expand(rownum);

                //Add Data
                for (int i = rownum; i < rownum + childNum + 1; i++)
                {
                    if (i == rownum)
                    {
                        for (int k = 0; k < ignoreIndex; k++)
                        {
                            DataGridViewTextBoxCell cellTextBox = new DataGridViewTextBoxCell();
                            cellTextBox.Value     = "";
                            this.Rows[i].Cells[k] = cellTextBox;
                        }
                    }
                    int j = ignoreIndex;
                    foreach (JProperty item2 in item)
                    {
                        this.Rows[i].Cells[j].Value = item2.Value;
                        j++;
                    }
                }
            }
        }