Skip to main content

ShapeLine Interface

Contains format settings for a line or a shape’s border.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

public interface ShapeLine

The following members return ShapeLine objects:

Remarks

Line Fill Settings

Use the ShapeLine.Fill property to access a LineFillFormat object that allows you to specify line fill options.

Method Description
LineFillFormat.SetNoFill Removes a fill from a line.
LineFillFormat.SetSolidFill Fills a line with a color.
LineFillFormat.SetGradientFill Applies a gradient to a line.

The example below show how to apply a solid color to a rectangle’s outline.

Rich_ShapeLine_SolidFill

// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
rectangle.Fill.SetNoFill();
// Format the rectangle's outline.
ShapeLine border = rectangle.Line;
// Fill the outline with a color.
border.Fill.SetSolidFill(Color.FromArgb(0x4D, 0x64, 0x8D));
// Set the line width.
border.Thickness = 6;

Line Style Formatting

Property Description
ShapeLine.Thickness Sets the line width.
ShapeLine.CapType Defines a cap style for line ends.
ShapeLine.CompoundType Specifies the compound line style.
ShapeLine.DashType Defines a dash style for a line.
ShapeLine.JoinType Specifies the line join type.
ShapeLine.LineAlignment Specifies the alignment of a border line relative to a shape.

The example below shows how to create a rectangle and change its border settings.

Rich_ShapeLine_Settings

// Add a rectangle to a document.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300));
// Fill the rectangle with color.
rectangle.Fill.SetSolidFill(Color.FromArgb(0xFF, 0xEE, 0xAD));
// Format the rectangle border.
ShapeLine border = rectangle.Line;
border.Color = Color.FromArgb(0x4D, 0x64, 0x8D);
border.Thickness = 6;
border.JoinType = LineJoinType.Miter;
border.DashType = LineDashType.Solid;
border.CompoundType = LineCompoundType.ThickThin;

Arrow Settings

Use the following properties to add arrows to the line ends:

Property Description
ShapeLine.BeginArrowType Adds an arrowhead to the beginning of a line.
ShapeLine.BeginArrowLength Defines the start arrowhead length.
ShapeLine.BeginArrowWidth Defines the start arrowhead width.
ShapeLine.EndArrowType Adds an arrowhead to the end of a line.
ShapeLine.EndArrowLength Defines the end arrowhead length.
ShapeLine.EndArrowWidth Defines the end arrowhead width.

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