Skip to main content
.NET Framework 4.5.2+

ShapeCollection.InsertLine(DocumentPosition, PointF, PointF) Method

Inserts a line in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v22.1.Core.dll

Declaration

Shape InsertLine(
    DocumentPosition pos,
    PointF start,
    PointF end
)

Parameters

Name Type Description
pos DocumentPosition

The position of the line’s anchor.

start PointF

An object that specifies x- and y-coordinates of the start point relative to the page’s top left corner. The Document.Unit property defines the measurement units.

end PointF

An object that specifies x- and y-coordinates of the end point relative to the page’s top left corner. The Document.Unit property defines the measurement units.

Returns

Type Description
Shape

The line embedded in the document.

Remarks

Use the Shape.Line property to access a ShapeLine object that allows you to customize a line’s appearance.

The example below shows how to create and format a line with arrowheads on both sides.

Rich_ShapeLine_WithArrows

// Add a line to a document.
Shape lineArrow = document.Shapes.InsertLine(document.Range.Start, new PointF(300, 300), new PointF(850, 300));
ShapeLine lineFormat = lineArrow.Line;
// Specify the line color.
lineFormat.Color = Color.OrangeRed;
// Set the line width.
lineFormat.Thickness = 5;
// Add arrowheads to the line ends.
lineFormat.BeginArrowType = LineArrowType.Diamond;
lineFormat.BeginArrowWidth = LineArrowSize.Large;
lineFormat.BeginArrowLength = LineArrowSize.Large;
lineFormat.EndArrowType = LineArrowType.StealthArrow;
lineFormat.EndArrowWidth = LineArrowSize.Large;
lineFormat.EndArrowLength = LineArrowSize.Large;
See Also