ZForge.Controls.ExplorerBar.TaskItem.CalcGdiPlusPreferredWidth C# (CSharp) Method

CalcGdiPlusPreferredWidth() protected method

Calculates the preferred width of the TaskItem using GDI+
protected CalcGdiPlusPreferredWidth ( Graphics g ) : int
g System.Drawing.Graphics The Graphics used to measure the TaskItem
return int
        protected int CalcGdiPlusPreferredWidth(Graphics g)
        {
            SizeF size = g.MeasureString(this.Text, this.Font, new SizeF(0, 0), this.StringFormat);

            int width = (int) Math.Ceiling(size.Width) + 18 + this.Padding.Left + this.Padding.Right;

            return width;
        }