home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Hello Windows Forms / PaintEvent / PaintEvent.cs next >
Encoding:
Text File  |  2001-01-15  |  620 b   |  24 lines

  1. //-----------------------------------------
  2. // PaintEvent.cs ⌐ 2001 by Charles Petzold
  3. //-----------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class PaintEvent
  9. {
  10.      public static void Main()
  11.      {
  12.           Form form   = new Form();
  13.           form.Text   = "Paint Event";
  14.           form.Paint += new PaintEventHandler(MyPaintHandler);
  15.  
  16.           Application.Run(form);
  17.      }
  18.      static void MyPaintHandler(object objSender, PaintEventArgs pea)
  19.      {
  20.           Graphics grfx = pea.Graphics;
  21.  
  22.           grfx.Clear(Color.Chocolate);
  23.      }
  24. }