DrawingObject.Line Property
Allows you to format a shape outline.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
#Declaration
#Property Value
Type | Description |
---|---|
Shape |
An object that contains line format settings. |
#Remarks
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.
#Line Fill Settings
Use the ShapeLine.Fill property to access a LineFillFormat object that allows you to specify line fill options.
Method | Description |
---|---|
Line |
Removes a fill from a line. |
Line |
Fills a line with a color. |
Line |
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;
#Line Style Formatting
Property | Description |
---|---|
Shape |
Sets the line width. |
Shape |
Defines a cap style for line ends. |
Shape |
Specifies the compound line style. |
Shape |
Defines a dash style for a line. |
Shape |
Specifies the line join type. |
Shape |
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;
#Arrow Settings
Use the following properties to add arrows to the line ends:
Property | Description |
---|---|
Shape |
Adds an arrowhead to the beginning of a line. |
Shape |
Defines the start arrowhead length. |
Shape |
Defines the start arrowhead width. |
Shape |
Adds an arrowhead to the end of a line. |
Shape |
Defines the end arrowhead length. |
Shape |
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;