StringAlignment.Far
using System;
using System.Drawing;
using System.Windows.Forms;
class FourCorners: Form
{
public static void Main()
{
Application.Run(new FourCorners());
}
public FourCorners()
{
Text = "Four Corners Text Alignment";
BackColor = SystemColors.Window;
ForeColor = SystemColors.WindowText;
ResizeRedraw = true;
}
protected override void OnPaint(PaintEventArgs pea)
{
Graphics graphics = pea.Graphics;
Brush brush = new SolidBrush(ForeColor);
StringFormat strfmt = new StringFormat();
strfmt.Alignment = StringAlignment.Far;
strfmt.LineAlignment = StringAlignment.Far;
graphics.DrawString("Lower right corner", Font, brush, ClientSize.Width, ClientSize.Height, strfmt);
}
}
Related examples in the same category