Stroke
Contents
[
Hide
]Stroke class
Defines a stroke for a shape.
To learn more, visit the Working with Shapes documentation article.
public class Stroke
Properties
Name | Description |
---|---|
BackColor { get; set; } | Gets or sets the background color of the stroke. |
BackThemeColor { get; set; } | Gets or sets a ThemeColor object that represents the stroke background color. |
BackTintAndShade { get; set; } | Gets or sets a double value that lightens or darkens the stroke background color. |
BaseForeColor { get; } | Gets the base foreground color of the stroke without any modifiers. |
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. |
Fill { get; } | Gets fill formatting for the Stroke . |
ForeColor { get; set; } | Gets or sets the foreground color of the stroke. |
ForeThemeColor { get; set; } | Gets or sets a ThemeColor object that represents the stroke foreground color. |
ForeTintAndShade { get; set; } | Gets or sets a double value that lightens or darkens the stroke foreground color. |
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. |
Remarks
Use the Stroke
property to access stroke properties of a shape. You do not create instances of the Stroke
class directly.
Examples
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;
stroke.Fill.TwoColorGradient(Color.Red, Color.Blue, GradientStyle.Vertical, GradientVariant.Variant1);
doc.Save(ArtifactsDir + "Shape.Stroke.docx");
See Also
- namespace Aspose.Words.Drawing
- assembly Aspose.Words