Drawing Lines

Having the ability to draw lines is fundamental to graphics development. GDI+ provides two key classes for line rendering. These are the Pen and Brush classes.

The Pen and Brush Classes

You use Pens to draw lines, shapes, and curves. The Pen can draw lines of different widths. You can also apply caps to lines (styles of endpoints to lines), and lines can be joined to form more complex shapes.

Brushes are used to fill a drawing surface. The surface area can be filled with a color, pattern, image, and texture.

This section covers various line techniques. In the example, there is a helper function that I’ll point out before I illustrate the various drawing samples. The first is a helper routine used to clear my drawing surface. This ...

Get Delphi for .NET Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.