Method DrawFilledPolygon
DrawFilledPolygon(Polygon, Color32, Color32, double)
Fills the interior of the specified polygon and then draws its outline, using a solid fill color and a solid stroke color with the given thickness.
public Canvas DrawFilledPolygon(Polygon polygon, Color32 fillColor, Color32 strokeColor, double strokeThickness = 1)
Parameters
polygonPolygonThe polygon to fill and outline.
fillColorColor32The interior fill color.
strokeColorColor32The outline stroke color.
strokeThicknessdoubleThe stroke thickness in pixels. Must be greater than zero. Defaults to 1.
Returns
Examples
var star = new Polygon(
new Point(100, 10), new Point(120, 70), new Point(180, 70),
new Point(130, 110), new Point(150, 170), new Point(100, 130),
new Point(50, 170), new Point(70, 110), new Point(20, 70),
new Point(80, 70));
var canvas = new Canvas(image);
canvas.DrawFilledPolygon(
star,
fillColor: new Color32(255, 220, 0),
strokeColor: new Color32(0, 0, 0),
strokeThickness: 2);
Exceptions
- ArgumentNullException
Thrown if
polygonis null.
DrawFilledPolygon(Polygon, Brush, Pen)
Fills the interior of the specified polygon and then draws its outline, using the given brush and pen.
public Canvas DrawFilledPolygon(Polygon polygon, Brush brush, Pen pen)
Parameters
polygonPolygonThe polygon to fill and outline.
brushBrushThe brush that defines the fill color.
penPenThe pen that defines the stroke color, thickness, line join, line cap, miter limit, and alignment.
Returns
Examples
var hexagon = Polygon.Regular(new Point(200, 200), 80, 6);
var brush = new Brush(new Color32(200, 255, 200));
var pen = new Pen(new Color32(0, 100, 0), 2) { LineJoin = LineJoin.Bevel };
var canvas = new Canvas(image);
canvas.DrawFilledPolygon(hexagon, brush, pen);
Exceptions
- ArgumentNullException
Thrown if
polygon,brush, orpenis null.