Share via


CanvasShapes.AddPolyline Method

Creates an open polyline or a closed polygon drawing. Returns a CanvasShapes object that represents the new polyline or polygon.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
Function AddPolyline ( _
    SafeArrayOfPoints As Object _
) As Shape
'Usage
Dim instance As CanvasShapes
Dim SafeArrayOfPoints As Object
Dim returnValue As Shape

returnValue = instance.AddPolyline(SafeArrayOfPoints)
Shape AddPolyline(
    Object SafeArrayOfPoints
)

Parameters

  • SafeArrayOfPoints
    Type: System.Object
    An array of coordinate pairs that specifies the polyline drawing's vertices.

Return Value

Type: Microsoft.Office.Interop.PowerPoint.Shape
Shape

Remarks

To form a closed polygon, assign the same coordinates to the first and last vertices in the polyline drawing.

Examples

This example adds a triangle to myDocument. Because the first and last points have the same coordinates, the polygon is closed and filled. The color of the triangle's interior will be the same as the default shape's fill color.

Dim triArray(1 To 4, 1 To 2) As Single

triArray(1, 1) = 25

triArray(1, 2) = 100

triArray(2, 1) = 100

triArray(2, 2) = 150

triArray(3, 1) = 150

triArray(3, 2) = 50

triArray(4, 1) = 25     ' Last point has same coordinates as first

triArray(4, 2) = 100

Set myDocument = ActivePresentation.Slides(1)

myDocument.Shapes.AddPolylineSafeArrayOfPoints:=triArray

See Also

Reference

CanvasShapes Interface

CanvasShapes Members

Microsoft.Office.Interop.PowerPoint Namespace