This article discusses
vital concepts, including the life cycle of a graphics application. After
reading this article, you should understand the basics of the GDI+ coordinate
system, basic graphics structures used by GDI+, drawing surfaces, and how to
write a graphics application using GDI+.
To write a graphics application, a good understanding of drawing surfaces and
coordinates system is necessary. We will begin by discussing these concepts and
how they are represented in GDI+. Then you'll learn step-by-step how to write a
graphics application in the .NET Framework using GDI+. We will cover the
following topics:
- How to add a reference to the GDI+ library
- How to get a drawing surface in the program
- How to create pens and brushes
- How to use pens and brushes to draw graphics objects
- Color
- Point and PointF
- Rectangle and RectangleF
- Size and SizeF
Every drawing application (regardless of the operating system), consists of three common components: a canvas, a brush or pen, and a process.
- The canvas is the space on which objects will be drawn. For example, in a Windows application, a Windows Form is a canvas.
- A brush or a pen represents the texture, color, and width of the objects to be drawn on the canvas.
- The process describes how objects are drawn on the canvas.
The process component of the drawing application includes making a call to draw the line or rectangle on the form.
Each drawing surface has four common properties: width, height, resolution, and color depth.
- The width and height properties of a surface determine the size of the surface, and they are specified by the number of pixels horizontally and vertically, respectively.
- The resolution property of a surface is a measurement of the output quality of graphics objects or images in dots per inch (dpi). For example, as resolution of 72 dpi means that 1 inch of the surface holds 72 horizontal and 72 vertical pixels. For monitors and LCDs, the resolution is frequently specified in terms of the total number of pixels horizontally and vertically rather than a pixel density. Thus a monitor resolution of 1280x1024 means that the screen of the monitor can hold 1280 horizontal pixels and 1024 vertical pixels.
- The color depth of a surface is the number of colors used to represent each pixel.




Join the conversation! Your thoughts help the community grow.