Pens, Lines, and Rectangles

GDI+ allows you to draw more than just text. You can draw lines, rectangles, circles, ellipses, and so on. You can even control the color in which you want to draw these graphical elements.

The System.Drawing.Pen class is provided in the .NET Framework to encapsulate colors used during the drawing process. You can create Pen objects based on colors you specify and then use these Pen objects when drawing text, lines, rectangles, or whatever.

The graphical elements such as lines and rectangles are drawn using methods on the Graphics object. The following method is one of several DrawLine methods that can be used to draw ...

Get Visual Basic® .NET by Example 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.