Share via


CanvasShapes.AddLine Method

Creates a line. Returns a CanvasShapes object that represents the new line.

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

Syntax

'Declaration
Function AddLine ( _
    BeginX As Single, _
    BeginY As Single, _
    EndX As Single, _
    EndY As Single _
) As Shape
'Usage
Dim instance As CanvasShapes
Dim BeginX As Single
Dim BeginY As Single
Dim EndX As Single
Dim EndY As Single
Dim returnValue As Shape

returnValue = instance.AddLine(BeginX, _
    BeginY, EndX, EndY)
Shape AddLine(
    float BeginX,
    float BeginY,
    float EndX,
    float EndY
)

Parameters

  • BeginX
    Type: System.Single
    The horizontal position, measured in points, of the line's starting point relative to the left edge of the slide.
  • BeginY
    Type: System.Single
    The vertical position, measured in points, of the line's starting point relative to the top edge of the slide.
  • EndX
    Type: System.Single
    The horizontal position, measured in points, of the line's ending point relative to the left edge of the slide.
  • EndY
    Type: System.Single
    The vertical position, measured in points, of the line's ending point relative to the top edge of the slide.

Return Value

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

Examples

This example adds a blue dashed line to myDocument.

Set myDocument = ActivePresentation.Slides(1)

With myDocument.Shapes.AddLine(BeginX:=10, BeginY:=10, _

        EndX:=250, EndY:=250).Line

    .DashStyle = msoLineDashDotDot

    .ForeColor.RGB = RGB(50, 0, 128)

End With

See Also

Reference

CanvasShapes Interface

CanvasShapes Members

Microsoft.Office.Interop.PowerPoint Namespace