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




Start-to-Finish Visual Basic 2005. Learn Visual Basic 2005 as You Design and Develop a Complete Application
Start-to-Finish Visual Basic 2005: Learn Visual Basic 2005 as You Design and Develop a Complete Application
ISBN: 0321398009
EAN: 2147483647
Year: 2006
Pages: 247
Authors: Tim Patrick

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net