StringAlignment.Far : StringAlignment « 2D Graphics « C# / C Sharp






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

1.Enuermate the StringAlignment value
2.String Alignment (PointF in DrawString)
3.StringAlignment.Center
4.StringAlignment.Near