Draw left justified text : Text Justify : Graphics C# Source Code


Custom Search

C# Source Code » Graphics » Text Justify »

 

Draw left justified text









    


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Form1 : System.Windows.Forms.Form{
  public Form1()
  {
        InitializeComponent();
        SetStyle(ControlStyles.Opaque, true);
        Bounds = new Rectangle(0, 0, 500, 300);
  }

    protected override void OnPaint(PaintEventArgs e) {
         Graphics g = e.Graphics;
   
         g.FillRectangle(Brushes.White, ClientRectangle);

         // Draw left justified text
         Rectangle rect = new Rectangle(0, 0, 400, Font.Height);
         g.DrawRectangle(Pens.Blue, rect);
         g.DrawString("www.navioo.com", Font,
            Brushes.Black, rect);

      }

    private void InitializeComponent()
    {
      this.Size = new System.Drawing.Size(300,300);
      this.Text = "Form1";
    }
    static void Main() 
    {
      Application.Run(new Form1());
    }
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Graphics
» Text Justify