dc.DrawText("my text", (Resources.GetFont
(Resources.FontResources.NinaB)), Colors.Black, 0, 0);
But I would like to center the text, and this gives an invalid
argument error:
dc.DrawText("my text", (Resources.GetFont
(Resources.FontResources.NinaB)), Colors.Black, 0, 0, 80, 70,
TextAlignment.Center, TextTrimming.None);
I've tried different values for width, height, TextAlignment, and
TextTrimming.
Suggestions welcome.
public static void DrawTextCenter(Bitmap bmp, string text, Font
font, Color color, int X, int Y, int Space)
{
int newWidth = 0;
int newHeight = 0;
font.ComputeExtent(text, out newWidth, out newHeight);
int offsetX = (Space - newWidth) / 2;
bmp.DrawText(text, font, color, X + offsetX, Y);
}
"Jan Axelson" wrote:
> .
>
Jan