参考Graphics 类
// C#
private void Form1_Paint(object sender, 
   System.Windows.Forms.PaintEventArgs pe) 
{
   // Declares the Graphics object and sets it to the Graphics object
   // supplied in the PaintEventArgs.
   Graphics g = pe.Graphics;
   // Insert code to paint the form here.
}