Class PenProp
Defines the properties of a pen, where the dimensions are in points.
public class PenProp
- Inheritance
-
PenProp
- Derived
- Inherited Members
Examples
PenProp redPen = new PenProp(1, Color.Red);
PenProp redDashedPen = new PenProp(1, Color.Red, 2, 0.5);
Constructors
PenProp(double, Color, params double[])
Initializes a new instance of the PenProp class with the specified width, color and pattern (on/off).
public PenProp(double width, Color color, params double[] patternOnOff)
Parameters
width
doubleThe width of the pen in points. The width zero means
hairline
.color
ColorThe color of the pen.
patternOnOff
double[]The pattern values for the pen (on/off) in points.
Remarks
On-Off-Pattern:
Parameter patternOnOff | Description | Example |
---|---|---|
- (no parameter) | line without dashes | new PenProp(0.5, Color.Blue) |
one number | x units on, x units off | new PenProp(0.5, Color.Blue, 2) |
list of numbers: a, b, c, d, ... | a units on, b units off, c units on, d units off, ... | new PenProp(0.5, Color.Blue, 5, 1, 2, 1) |
PenProp(double, params double[])
Initializes a new instance of the PenProp class with the specified width and pattern (on/off).
public PenProp(double width, params double[] patternOnOff)
Parameters
width
doubleThe width of the pen in points. The width zero means
hairline
.patternOnOff
double[]The pattern values for the pen (on/off) in points.
Remarks
On-Off-Pattern:
Parameter patternOnOff | Description | Example |
---|---|---|
- (no parameter) | line without dashes | new PenProp(0.5, Color.Blue) |
one number | x units on, x units off | new PenProp(0.5, Color.Blue, 2) |
list of numbers: a, b, c, d, ... | a units on, b units off, c units on, d units off, ... | new PenProp(0.5, Color.Blue, 5, 1, 2, 1) |
Properties
Color
Gets the color of the pen.
public Color Color { get; }
Property Value
- Color
The color of the pen.
PatternOnOff
Gets the pattern values of the pen.
public double[] PatternOnOff { get; }
Property Value
- double[]
The array of pattern values.
Remarks
On-Off-Pattern:
Property PatternOnOff | Description | Example |
---|---|---|
- (empty array) | line without dashes | [] |
one number | x units on, x units off | [2] |
list of numbers: a, b, c, d, ... | a units on, b units off, c units on, d units off, ... | [5, 1, 2, 1] |
Width
Gets the width of the pen.
The width zero means hairline
.
public double Width { get; }
Property Value
- double
The width in points.
WidthMM
Gets the width of the pen in millimeters.
The width zero means hairline
.
public double WidthMM { get; }
Property Value
- double
The width in millimeters.
Methods
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Operators
operator ==(PenProp?, PenProp?)
Determines whether two pens are equal.
public static bool operator ==(PenProp? left, PenProp? right)
Parameters
Returns
operator !=(PenProp?, PenProp?)
Determines whether two pens are not equal.
public static bool operator !=(PenProp? left, PenProp? right)