Now that we know there is an OnPaint function, and what the parameters are, add code to override the OnPaint function in your Form class and try it out.
protected override void OnPaint( PaintEventArgs pe ) { Graphics g = pe.Graphics; Pen myPen = new Pen( Color.Blue, 2 ); g.DrawLine( myPen, 10, 10, 210, 210 ); g.DrawLine( myPen, 10, 210, 210, 10 ); g.DrawEllipse( myPen, 50, 50, 200, 100 ); myPen.Dispose(); }
Here is a screen shot showing the results.
For more information, look in the .NET Framework SDK documentation, in the .NET Framework Reference section. Look for the Graphics class in the System.Drawing namespace. Look for the Form class in the System.Windows.Forms namespace.
Comments