Name
freeformbuilder.AddNodes(SegmentType, EditingType, X1, Y1, [X2], [Y2], [X3], [Y3])
Synopsis
Adds a segment to the freeform shape.
|
Argument |
Settings |
|---|---|
|
|
The type of segment to add. Can be |
|
|
The editing property of the vertex. Can be |
|
|
The horizontal coordinates of the vertices. |
|
|
The vertical coordinates of the vertices. |
The following code creates a freeform, adds segments, and then renders the freeform as a shape on the active worksheet:
Sub DrawAndFillFreeForm( )
Dim ws As Worksheet, fb As FreeformBuilder, s As Shape
Set ws = ActiveSheet
' Create the freeform builder.
Set fb = ws.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
' Add segments.
fb.AddNodes msoSegmentCurve, msoEditingCorner, _
380, 230, 400, 250, 450, 300
fb.AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
fb.AddNodes msoSegmentLine, msoEditingAuto, 480, 400
fb.AddNodes msoSegmentLine, msoEditingAuto, 360, 200
' Render the shape.
Set s = fb.ConvertToShape
' Fill the shape.
s.Fill.ForeColor.RGB = &HFF
s.Fill.Solid
End SubBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access