FormPaint Event : Form Paint « GUI Windows Forms « C# / CSharp Tutorial






FormPaint Event
using System;        
using System.Drawing;
using System.Windows.Forms;

public class FormPaintEvent : Form
{

  public FormPaintEvent()
  {
    Size = new Size(300,200);
    Paint += new PaintEventHandler(PaintHandler);
  }

  static void Main() 
  {
    Application.Run(new FormPaintEvent());
  }

  private void PaintHandler(object sender, PaintEventArgs e)
  {
    Graphics g = e.Graphics;
    g.DrawString("www.java2s.com", Font, Brushes.Black, 50, 75);
  }
}








23.4.Form Paint
23.4.1.FormPaint EventFormPaint Event
23.4.2.Override Paint method for FormOverride Paint method for Form
23.4.3.Paint Invalidate DemonstrationPaint Invalidate Demonstration