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) thePath.Dispose() This code block draws a smiley face on the canvas (see Figure 17-10). Figure 17-10. 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. |