O'Reilly logo

Visual Basic® .NET by Example by Bob Donald, Gabriel Oancea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required