Gets or sets a horizontal text alignment.
Namespace:
Aurigma.GraphicsMill.Drawing
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
public HorizontalAlignment HorizontalAlignment { get; set; }
using (var bitmap = new Bitmap(100, 100, PixelFormat.Format24bppRgb, RgbColor.White)) { using (var graphics = bitmap.GetGraphics()) { var pen = new Pen(RgbColor.Red, 1); graphics.DrawLine(pen, 50, 0, 50, 100); var brush = new SolidBrush(RgbColor.Black); //Adjust font settings var font = new Font("Arial", 20, false, false); //Draw text with different horizontal alignments font.HorizontalAlignment = HorizontalAlignment.Left; graphics.DrawString("Left", font, brush, 50, 0); font.HorizontalAlignment = HorizontalAlignment.Center; graphics.DrawString("Center", font, brush, 50, 33); font.HorizontalAlignment = HorizontalAlignment.Right; graphics.DrawString("Right", font, brush, 50, 63); bitmap.Save(@"Images\Output\string.png"); } }