Class Pen
Describes how a stroke is drawn.
public sealed class Pen : AvaloniaObject, INotifyPropertyChanged, IPen
- Inheritance
-
Pen
- Implements
- Inherited Members
- Extension Methods
Constructors
Pen()
Initializes a new instance of the Pen class.
public Pen()
Pen(IBrush?, double, IDashStyle?, PenLineCap, PenLineJoin, double)
Initializes a new instance of the Pen class.
public Pen(IBrush? brush, double thickness = 1, IDashStyle? dashStyle = null, PenLineCap lineCap = PenLineCap.Flat, PenLineJoin lineJoin = PenLineJoin.Miter, double miterLimit = 10)
Parameters
brush
IBrushThe brush used to draw.
thickness
doubleThe stroke thickness.
dashStyle
IDashStyleThe dash style.
lineCap
PenLineCapThe line cap.
lineJoin
PenLineJoinThe line join.
miterLimit
doubleThe miter limit.
Pen(uint, double, IDashStyle?, PenLineCap, PenLineJoin, double)
Initializes a new instance of the Pen class.
public Pen(uint color, double thickness = 1, IDashStyle? dashStyle = null, PenLineCap lineCap = PenLineCap.Flat, PenLineJoin lineJoin = PenLineJoin.Miter, double miterLimit = 10)
Parameters
color
uintThe stroke color.
thickness
doubleThe stroke thickness.
dashStyle
IDashStyleThe dash style.
lineCap
PenLineCapSpecifies the type of graphic shape to use on both ends of a line.
lineJoin
PenLineJoinThe line join.
miterLimit
doubleThe miter limit.
Fields
BrushProperty
Defines the Brush property.
public static readonly StyledProperty<IBrush?> BrushProperty
Field Value
DashStyleProperty
Defines the DashStyle property.
public static readonly StyledProperty<IDashStyle?> DashStyleProperty
Field Value
LineCapProperty
Defines the LineCap property.
public static readonly StyledProperty<PenLineCap> LineCapProperty
Field Value
LineJoinProperty
Defines the LineJoin property.
public static readonly StyledProperty<PenLineJoin> LineJoinProperty
Field Value
MiterLimitProperty
Defines the MiterLimit property.
public static readonly StyledProperty<double> MiterLimitProperty
Field Value
ThicknessProperty
Defines the Thickness property.
public static readonly StyledProperty<double> ThicknessProperty
Field Value
Properties
Brush
Gets or sets the brush used to draw the stroke.
public IBrush? Brush { get; set; }
Property Value
DashStyle
Gets or sets the style of dashed lines drawn with a Pen object.
public IDashStyle? DashStyle { get; set; }
Property Value
LineCap
Gets or sets the type of shape to use on both ends of a line.
public PenLineCap LineCap { get; set; }
Property Value
LineJoin
Gets or sets the join style for the ends of two consecutive lines drawn with this Pen.
public PenLineJoin LineJoin { get; set; }
Property Value
MiterLimit
Gets or sets the limit of the thickness of the join on a mitered corner.
public double MiterLimit { get; set; }
Property Value
Thickness
Gets or sets the stroke thickness.
public double Thickness { get; set; }
Property Value
Methods
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.
ToImmutable()
Creates an immutable clone of the brush.
public ImmutablePen ToImmutable()
Returns
- ImmutablePen
The immutable clone.