/// <summary>
        /// Returns a copy of the column.
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            ComboTreeBoxColumn that = (ComboTreeBoxColumn)base.Clone();

            that.Nodes.AddRange(this.Nodes);
            that.UseNodeNamesForPath = this.UseNodeNamesForPath;
            that.PathSeparator       = this.PathSeparator;
            that.ShowPath            = this.ShowPath;
            that.Images             = this.Images;
            that.ImageIndex         = this.ImageIndex;
            that.ImageKey           = this.ImageKey;
            that.ExpandedImageIndex = this.ExpandedImageIndex;
            that.ExpandedImageKey   = this.ExpandedImageKey;
            return(that);
        }
        /// <summary>
        /// Paints the cell.
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="clipBounds"></param>
        /// <param name="cellBounds"></param>
        /// <param name="rowIndex"></param>
        /// <param name="cellState"></param>
        /// <param name="value"></param>
        /// <param name="formattedValue"></param>
        /// <param name="errorText"></param>
        /// <param name="cellStyle"></param>
        /// <param name="advancedBorderStyle"></param>
        /// <param name="paintParts"></param>
        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);

            BeforePaintContent(graphics, cellBounds, cellState, cellStyle, paintParts);

            if (paintParts.HasFlag(DataGridViewPaintParts.ContentForeground))
            {
                ComboTreeBoxColumn column = (ComboTreeBoxColumn)OwningColumn;
                ComboTreeNode      node   = Nodes.ParsePath(Convert.ToString(formattedValue), column.PathSeparator, column.UseNodeNamesForPath);
                string             displayValue;

                if (column.ShowPath)
                {
                    displayValue = Convert.ToString(formattedValue);
                }
                else
                {
                    displayValue = (node != null) ? node.Text : String.Empty;
                }

                Image img = ComboTreeBox.GetNodeImage(node, column.Images, column.ImageIndex, column.ImageKey, column.ExpandedImageIndex, column.ExpandedImageKey);

                Rectangle contentBounds = cellBounds;
                contentBounds.Width -= 17;
                TextFormatFlags flags = ComboTreeBox.TEXT_FORMAT_FLAGS | TextFormatFlags.PreserveGraphicsClipping;

                Rectangle imgBounds = (img == null)
                                        ? new Rectangle(Point.Add(contentBounds.Location, new Size(1, 0)), Size.Empty)
                                        : new Rectangle(contentBounds.Left + 4, contentBounds.Top + (contentBounds.Height / 2 - img.Height / 2), img.Width, img.Height);

                Rectangle txtBounds = new Rectangle(imgBounds.Right, contentBounds.Top, contentBounds.Right - imgBounds.Right - 3, contentBounds.Height);

                if (img != null)
                {
                    graphics.DrawImage(img, imgBounds);
                }

                TextRenderer.DrawText(graphics, displayValue, cellStyle.Font, txtBounds, cellStyle.ForeColor, flags);
            }

            AfterPaintContent(graphics, clipBounds, cellBounds, rowIndex, cellStyle, advancedBorderStyle, paintParts);
        }
        /// <summary>
        /// Initialises the editing control for the cell.
        /// </summary>
        /// <param name="rowIndex"></param>
        /// <param name="initialFormattedValue"></param>
        /// <param name="dataGridViewCellStyle"></param>
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);

            ComboTreeBoxEditingControl control = DataGridView.EditingControl as ComboTreeBoxEditingControl;
            ComboTreeBoxColumn         column  = (ComboTreeBoxColumn)OwningColumn;

            if (control != null)
            {
                control.BeginUpdate();
                control.Nodes.Clear();
                control.ImageIndex         = column.ImageIndex;
                control.ImageKey           = column.ImageKey;
                control.ExpandedImageIndex = column.ExpandedImageIndex;
                control.ExpandedImageKey   = column.ExpandedImageKey;
                control.Images             = column.Images;
                control.Nodes.AddRange(Nodes);
                control.Path = Convert.ToString(initialFormattedValue);
                control.EndUpdate();
            }
        }