Stroke class

Defines a stroke for a shape.

public class Stroke


Name Description
BackColor { get; set; } Gets or sets the background color of the stroke.
Color { get; set; } Defines the color of a stroke.
Color2 { get; set; } Defines a second color for a stroke.
DashStyle { get; set; } Specifies the dot and dash pattern for a stroke.
EndArrowLength { get; set; } Defines the arrowhead length for the end of a stroke.
EndArrowType { get; set; } Defines the arrowhead for the end of a stroke.
EndArrowWidth { get; set; } Defines the arrowhead width for the end of a stroke.
EndCap { get; set; } Defines the cap style for the end of a stroke.
ForeColor { get; set; } Gets or sets the foreground color of the stroke.
ImageBytes { get; } Defines the image for a stroke image or pattern fill.
JoinStyle { get; set; } Defines the join style of a polyline.
LineStyle { get; set; } Defines the line style of the stroke.
On { get; set; } Defines whether the path will be stroked.
Opacity { get; set; } Defines the amount of transparency of a stroke. Valid range is from 0 to 1.
StartArrowLength { get; set; } Defines the arrowhead length for the start of a stroke.
StartArrowType { get; set; } Defines the arrowhead for the start of a stroke.
StartArrowWidth { get; set; } Defines the arrowhead width for the start of a stroke.
Transparency { get; set; } Gets or sets a value between 0.0 (opaque) and 1.0 (clear) representing the degree of transparency of the stroke.
Visible { get; set; } Gets or sets a flag indicating whether the stroke is visible.
Weight { get; set; } Defines the brush thickness that strokes the path of a shape in points.


Use the Stroke property to access stroke properties of a shape. You do not create instances of the Stroke class directly.


Shows how change stroke properties.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.InsertShape(ShapeType.Rectangle, RelativeHorizontalPosition.LeftMargin, 100,
    RelativeVerticalPosition.TopMargin, 100, 200, 200, WrapType.None);

// Basic shapes, such as the rectangle, have two visible parts.
// 1 -  The fill, which applies to the area within the outline of the shape:
shape.Fill.ForeColor = Color.White;

// 2 -  The stroke, which marks the outline of the shape:
// Modify various properties of this shape's stroke.
Stroke stroke = shape.Stroke;
stroke.On = true;
stroke.Weight = 5;
stroke.Color = Color.Red;
stroke.DashStyle = DashStyle.ShortDashDotDot;
stroke.JoinStyle = JoinStyle.Miter;
stroke.EndCap = EndCap.Square;
stroke.LineStyle = ShapeLineStyle.Triple;

doc.Save(ArtifactsDir + "Shape.Stroke.docx");

See Also