示例#1
0
        private void CellsCollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            // Exit if there already is a tree cell for this row
            if (_treeCell != null)
            {
                return;
            }

            if (e.Action == CollectionChangeAction.Add || e.Action == CollectionChangeAction.Refresh)
            {
                TreeDataGridViewTextBoxCell treeCell = null;

                if (e.Element == null)
                {
                    foreach (DataGridViewCell cell in base.Cells)
                    {
                        if (cell.GetType().IsSubclassOf(typeof(TreeDataGridViewTextBoxCell)) ||
                            cell.GetType().Name == nameof(TreeDataGridViewTextBoxCell))
                        {
                            treeCell = (TreeDataGridViewTextBoxCell)cell;
                            break;
                        }
                    }
                }
                else
                {
                    treeCell = e.Element as TreeDataGridViewTextBoxCell;
                }

                if (treeCell != null)
                {
                    _treeCell = treeCell;
                }
            }
        }
示例#2
0
        public override object Clone()
        {
            TreeDataGridViewTextBoxCell c = (TreeDataGridViewTextBoxCell)base.Clone();

            c._glyphWidth            = _glyphWidth;
            c._calculatedLeftPadding = _calculatedLeftPadding;

            return(c);
        }