public partial class Draw : Form


...{

public Draw()


...{

InitializeComponent();


SetStyle(ControlStyles.Opaque, true);

}

protected override void OnPaint(PaintEventArgs e)


...{

Graphics g = e.Graphics;

g.FillRectangle(Brushes.Wheat, ClIEntRectangle);

using (Pen pen = new Pen(Color.Red, 1))


...{

for (int y = 0; y<=ClientRectangle.Height; y += ClIEntRectangle.Height / 12)


g.DrawLine(pen, new Point(0, 0), new Point(ClIEntRectangle.Width, y));

}

}

g.FillEllipse(Brushes.Red,new Rectangle(100,100,50,50));

}

}
運行得效果:
