Back to Devexpress

ShapeLine Interface

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-d4fab543.md

latest7.4 KB
Original Source

ShapeLine Interface

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

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public interface ShapeLine
vb
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.

MethodDescription
LineFillFormat.SetNoFillRemoves a fill from a line.
LineFillFormat.SetSolidFillFills a line with a color.
LineFillFormat.SetGradientFillApplies a gradient to a line.

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

csharp
// 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;
vb
' 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

Line Style Formatting

PropertyDescription
ShapeLine.ThicknessSets the line width.
ShapeLine.CapTypeDefines a cap style for line ends.
ShapeLine.CompoundTypeSpecifies the compound line style.
ShapeLine.DashTypeDefines a dash style for a line.
ShapeLine.JoinTypeSpecifies the line join type.
ShapeLine.LineAlignmentSpecifies the alignment of a border line relative to a shape.

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

csharp
// 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;
vb
' 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

Arrow Settings

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

PropertyDescription
ShapeLine.BeginArrowTypeAdds an arrowhead to the beginning of a line.
ShapeLine.BeginArrowLengthDefines the start arrowhead length.
ShapeLine.BeginArrowWidthDefines the start arrowhead width.
ShapeLine.EndArrowTypeAdds an arrowhead to the end of a line.
ShapeLine.EndArrowLengthDefines the end arrowhead length.
ShapeLine.EndArrowWidthDefines the end arrowhead width.

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

csharp
// 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;
vb
' 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

ShapeLine Members

DevExpress.XtraRichEdit.API.Native Namespace