officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-drawingobject-383a750b.md
Allows you to format a shape outline.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
ShapeLine Line { get; }
ReadOnly Property Line As ShapeLine
| Type | Description |
|---|---|
| ShapeLine |
An object that contains line format settings.
|
Use the Line property to format a line or a shape’s border. This property returns null for a shape group, so you cannot specify line settings for all elements in the group at once. Iterate through the group items and change the outline for each shape individually.
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.
// 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;
' Create a rectangle.
Dim rectangle As Shape = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, New RectangleF(300, 200, 500, 300))
rectangle.Fill.SetNoFill()
' Format the rectangle's outline.
Dim border As ShapeLine = rectangle.Line
' Fill the outline with a color.
border.Fill.SetSolidFill(Color.FromArgb(&H4D, &H64, &H8D))
' Set the line width.
border.Thickness = 6
| 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.
// 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;
' Add a rectangle to a document.
Dim rectangle As Shape = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, New RectangleF(300, 200, 500, 300))
' Fill the rectangle with color.
rectangle.Fill.SetSolidFill(Color.FromArgb(&HFF, &HEE, &HAD))
' Format the rectangle border.
Dim border As ShapeLine = rectangle.Line
border.Color = Color.FromArgb(&H4D, &H64, &H8D)
border.Thickness = 6
border.JoinType = LineJoinType.Miter
border.DashType = LineDashType.Solid
border.CompoundType = LineCompoundType.ThickThin
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.
// 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;
' Add a line to a document.
Dim lineArrow As Shape = document.Shapes.InsertLine(document.Range.Start, New PointF(300, 300), New PointF(850, 300))
Dim lineFormat As ShapeLine = 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