AdvancedDataGridView.TreeGridCell.UpdateStyle C# (CSharp) Метод

UpdateStyle() защищенный Метод

protected UpdateStyle ( ) : void
Результат void
        protected internal virtual void UpdateStyle()
        {
            // styles shouldn't be modified when we are not sited.
            if (this.IsSited == false) return;

            int level = this.Level;

            Padding p = this._previousPadding;
            Size preferredSize;

            using (Graphics g = this.OwningNode._grid.CreateGraphics() ) {
                preferredSize =this.GetPreferredSize(g, this.InheritedStyle, this.RowIndex, new Size(0, 0));
            }

            Image image = this.OwningNode.Image;

            if (image != null)
            {
                // calculate image size
                _imageWidth = image.Width+2;
                _imageHeight = image.Height+2;

            }
            else
            {
                _imageWidth = glyphWidth;
                _imageHeight = 0;
            }

            // TODO: Make this cleaner
            if (preferredSize.Height < _imageHeight)
            {

                this.Style.Padding = new Padding(p.Left + (level * INDENT_WIDTH) + _imageWidth + INDENT_MARGIN,
                                                 p.Top + (_imageHeight / 2), p.Right, p.Bottom + (_imageHeight / 2));
                _imageHeightOffset = 2;// (_imageHeight - preferredSize.Height) / 2;
            }
            else
            {
                this.Style.Padding = new Padding(p.Left + (level * INDENT_WIDTH) + _imageWidth + INDENT_MARGIN,
                                                 p.Top , p.Right, p.Bottom );

            }

            calculatedLeftPadding = ((level - 1) * glyphWidth) + _imageWidth + INDENT_MARGIN;
        }