/// <summary>
        /// 该节点是否为某一级节点的最后一个子结点
        /// </summary>
        /// <param name="level">节点层级</param>
        /// <returns></returns>
        private bool IsLastCell(int level)
        {
            int row = DataGridView.Rows.GetNextRow(RowIndex, DataGridViewElementStates.None);

            if (row == -1)
            {
                return(true);
            }
            DataGridViewGroupCell cel = DataGridView.Rows[row].Cells[0] as DataGridViewGroupCell;

            return(cel.GroupLevel == level);
        }
        public int AddChildCellRange(DataGridViewGroupCell cellP, DataGridViewGroupCell[] cells)
        {
            bool needRedraw = false;

            if (childCells == null)
            {
                //需要画一个加号
                childCells = new List <DataGridViewGroupCell>();
                needRedraw = true;
            }
            foreach (DataGridViewGroupCell cell in cells)
            {
                childCells.Add(cell);
                cell.groupLevel = groupLevel + 1;
                cell.ParentCell = cellP;
            }

            if (needRedraw)
            {
                DataGridView.InvalidateCell(this);
            }
            return(childCells.Count);
        }
 /// <summary>
 /// 添加子结点
 /// </summary>
 /// <param name="cell"></param>
 /// <returns></returns>
 public int AddChildCell(DataGridViewGroupCell cellP, DataGridViewGroupCell cell)
 {
     return(AddChildCellRange(cellP, new DataGridViewGroupCell[] { cell }));
 }
 public DataGridViewGroupColumn()
 {
     CellTemplate = new DataGridViewGroupCell();
     ReadOnly     = true;
 }