Exemple #1
0
        /// <summary>
        /// Draw centred text
        /// </summary>
        /// <param name="context">The graphics context to draw on</param>
        /// <param name="text">The text to draw</param>
        /// <param name="point">The point to centre the text around</param>
        protected void DrawCentredText(IDrawContext context, string text, Point point)
        {
            var    extents = context.GetTextExtents(text);
            double x       = point.X - (extents.Width / 2 + extents.X);
            double y       = point.Y - (extents.Height / 2 + extents.Y);

            context.MoveTo(x, y);
            context.ShowText(text);
        }