Exemplo n.º 1
0
        public static Size MeasureString(
            bool useCompatibleTextRendering, Graphics graphics, string text, Font font, RectangleF bounds, StringFormat format)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(Size.Empty);
            }

            if (useCompatibleTextRendering)
            {
                return(GdiPlusStringRenderer.MeasureString(graphics, text, font, bounds, format));
            }
            else
            {
                return(GdiStringRenderer.MeasureString(graphics, text, font, Rectangle.Round(bounds), format));
            }
        }
Exemplo n.º 2
0
        public static void DrawString(
            bool useCompatibleTextRendering, Graphics graphics, string text, Font font, Brush foreBrush, Color foreColor, RectangleF bounds,
            StringFormat format)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            if (useCompatibleTextRendering)
            {
                GdiPlusStringRenderer.DrawString(graphics, text, font, foreBrush, bounds, format);
            }
            else
            {
                GdiStringRenderer.DrawString(graphics, text, font, foreColor, Rectangle.Round(bounds), format);
            }
        }