Some Basic GDI+ Objects
SUMMARY
Before you write a graphics application, a basic understanding of drawing surfaces and coordinate systems is a must. This chapter began with the basics of the drawing surfaces and the coordinate system, describing how drawing surfaces and coordinate systems are represented in GDI+ and how the GDI+ coordinate system differs from other coordinate systems.
Before using any GDI+-related classes defined in the .NET Framework library, you must reference System.Drawing and its subnamespaces. In this chapter you learned how to add references to the GDI+ library and how to import the GDI+-related namespaces into your application. After adding a reference to the GDI+ library and namespaces to the application, the next step is to get the Graphics object. There are several ways to get a Graphics object in an application. This chapter discussed three different ways, and then showed how to use the Graphics class methods to draw and fill lines, rectangles, and ellipses. You also learned to dispose of objects when you're finished with them.
Finally, we covered some basic GDI+ structuresincluding Color, Rectangle, RectangleF, Point, PointF, Size, and SizeFdescribing their members and how to use them in your applications.
You should now be able to write simple graphics applications using GDI+.
Chapter 3 is all about the Graphics class and will demonstrate how quickly you can write real-world applications. By the end of Chapter 3, you will be able to write your own 2D paint application similar to Microsoft's PaintBrush, using your newly acquired GDI+ skills.