Paths: Drawings on Macro-Vision

Paths: Drawings on Macro-Vision

The GraphicsPath class lets you collect several of the more primitive drawing objects (like lines and arcs, and even rectangles) into a single grouped unit. This full path can then be replayed onto a graphics surface such as a macro.

Dim thePath As New Drawing2D.GraphicsPath

thePath.AddEllipse(0, 0, 50, 50)
thePath.AddArc(10, 30, 30, 10, 10, 160)
thePath.AddRectangle(New Rectangle(15, 15, 5, 5))
thePath.AddRectangle(New Rectangle(30, 15, 5, 5))

e.Graphics.DrawPath(Pens.Black, thePath)


This code block draws a smiley face on the canvas (see Figure).

Drawing with a GraphicsPath object

That's cute. Fortunately, there are other uses for graphics paths, some of which I'll discuss in the following section.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows