This namespace provides classes and support for construction and display of arbitrary graphical objects.
A few examples of using classes in this namespace can be found in the ImageProcessing application in Appendix A,“C# Basics.”
You can also find a simple example in the Scribble directory. You create two cached variables:
private Graphics graphics = null; private Point lastPoint;
When you click on a mouse button, the OnMouseDown event handler is called, the Graphics object is created, and the current point is saved.
graphics = CreateGraphics(); lastPoint = new Point(e.X, e.Y);
When the mouse button is released, the Graphics object is destroyed.
graphics.Dispose(); graphics = null;
The OnMouseMove handler is called and a ...