BrightIdeasSoftware.BaseRenderer.CalculateAlignedRectangle C# (CSharp) Метод

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

Calculate the space that our rendering will occupy and then align that space with the given rectangle, according to the Column alignment
protected CalculateAlignedRectangle ( Graphics g, Rectangle r ) : Rectangle
g System.Drawing.Graphics
r System.Drawing.Rectangle
Результат System.Drawing.Rectangle
        protected virtual Rectangle CalculateAlignedRectangle(Graphics g, Rectangle r)
        {
            if (this.Column == null || this.Column.TextAlign == HorizontalAlignment.Left)
                return r;

            int width = this.CalculateCheckBoxWidth(g);
            width += this.CalculateImageWidth(g, this.GetImageSelector());
            width += this.CalculateTextWidth(g, this.GetText());

            // If the combined width is greater than the whole cell,
            // we just use the cell itself
            if (width >= r.Width)
                return r;

            return this.AlignRectangle(r, new Rectangle(0, 0, width, r.Height));
        }