Draw String : Graphics « 2D « C# / CSharp Tutorial






using System;
using System.Drawing;
using System.Windows.Forms;
class PaintHello
{
     public static void Main()
     {
          Form form      = new Form();
          form.Text      = "Paint Hello";
          form.BackColor = Color.White;
          form.Paint    += new PaintEventHandler(MyPaintHandler);
   
          Application.Run(form);
     }
     static void MyPaintHandler(object objSender, PaintEventArgs pea)
     {
          Form     form = (Form)objSender;
          Graphics graphics = pea.Graphics;
   
          graphics.DrawString("Hello, world!", form.Font, Brushes.Black, 0, 0);
     }
}








27.1.Graphics
27.1.1.Create Graphics from Form object
27.1.2.Draw String
27.1.3.TranslateTransform a Graphics
27.1.4.Graphics.DrawImage
27.1.5.Graphics.DrawLine
27.1.6.Graphics.DrawLines
27.1.7.Set SmoothingMode
27.1.8.Draw along with the Tab
27.1.9.Graphics.DrawIcon
27.1.10.Double Buffering Example
27.1.11.No Double Buffering Example