private RectangleF WriteTextInElLipseWithBorder(RenderColor background, RenderColor foreground, object text, System.Drawing.Font font, PointF topLeft, bool shiftUp, bool shiftLeft) { string renderText = (text == null) ? " " : text.ToString(); SizeF linesStringSize = _Canvas.MeasureString(renderText, font); PointF newTopLeft; if (shiftUp) { newTopLeft = new PointF(topLeft.X, topLeft.Y - linesStringSize.Height); } else { newTopLeft = topLeft; } if (shiftLeft) { newTopLeft = new PointF(newTopLeft.X - linesStringSize.Width, newTopLeft.Y); } RectangleF bounds = new RectangleF(newTopLeft.X, newTopLeft.Y, linesStringSize.Width, linesStringSize.Height); _Canvas.FillEllipse(MyColors.GetBrush(background), bounds); _Canvas.DrawString(renderText, font, MyColors.GetBrush(foreground), newTopLeft); _Canvas.DrawEllipse(MyColors.GetPen(foreground), bounds); return(bounds); }