예제 #1
0
        /// <summary>
        /// 该节点是否为某一级节点的最后一个子结点
        /// </summary>
        /// <param name="level">节点层级</param>
        /// <returns></returns>
        private bool IsLastCell(int level)
        {
            if (RowIndex == DataGridView.Rows.Count - 1)
            {
                return(true);
            }

            var cell = this;

            while (level < cell.GroupLevel)
            {
                cell = cell.ParentCell;
            }

            for (int i = RowIndex + 1; i < DataGridView.Rows.Count; i++)
            {
                DataGridViewGroupCell cel = DataGridView.Rows[i].Cells[0] as DataGridViewGroupCell;
                if (cel.GroupLevel == level && cel.ParentCell == cell.ParentCell)
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
 /// <summary>
 /// 添加子结点
 /// </summary>
 /// <param name="cell"></param>
 /// <returns></returns>
 public int AddChildCell(DataGridViewGroupCell cell)
 {
     return(AddChildCellRange(new[] { cell }));
 }