Polygon Polygon Polygon Class

Definition

Draws a polygon, which is a connected series of lines that form a closed shape.

public : sealed class Polygon : Shape, IPolygonpublic sealed class Polygon : Shape, IPolygonPublic NotInheritable Class Polygon Inherits Shape Implements IPolygon
<Polygon .../>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Examples

This example shows how to use a Polygon to create a triangle.

<Canvas>

  <!- - This polygon shape uses pre-defined color values for its Stroke and
       Fill properties.
       The SolidColorBrush's Opacity property affects the fill color in
       this case by making it slightly transparent (opacity of 0.4) so
       that it blends with any underlying color. - ->

  <Polygon
    Points="300,200 400,125 400,275"
    Stroke="Purple"
    StrokeThickness="2">
    <Polygon.Fill>
       <SolidColorBrush Color="Blue" Opacity="0.4"/>
    </Polygon.Fill>
  </Polygon> 

</Canvas>

Remarks

The Polygon object is similar to the Polyline object, except that Polygon must be a closed shape.

You define the shape by adding vertices to the Points collection. For example, two points could form a line, three points could form a triangle, and four points could form a quadrilateral.

The FillRule property specifies how the interior area of the shape is determined. See the FillRule enumeration for more info.

You can set the Fill property to give the shape a background fill, like a solid color, gradient, or image. You can set the Stroke and other related stroke properties to specify the look of the shape's outline.

Constructors

Polygon() Polygon() Polygon()

Initializes a new instance of the Polygon class.

public : Polygon()public Polygon()Public Sub New()
Attributes

Properties

FillRule FillRule FillRule

Gets or sets a value that specifies how the interior fill of the shape is determined.

public : FillRule FillRule { get; set; }public FillRule FillRule { get; set; }Public ReadWrite Property FillRule As FillRule
<Polygon FillRule="Nonzero"/>
-or-
<Polygon FillRule="EvenOdd"/>
Value
FillRule FillRule FillRule

A value of the enumeration. The default is EvenOdd.

Attributes

Remarks

See the FillRule enumeration for more info.

FillRuleProperty FillRuleProperty FillRuleProperty

Identifies the FillRule dependency property.

public : static DependencyProperty FillRuleProperty { get; }public static DependencyProperty FillRuleProperty { get; }Public Static ReadOnly Property FillRuleProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the FillRule dependency property.

Attributes

Points Points Points

Gets or sets a collection that contains the vertex points of the polygon.

public : PointCollection Points { get; set; }public PointCollection Points { get; set; }Public ReadWrite Property Points As PointCollection
<Polygon Points="pointSet"/>
Value
PointCollection PointCollection PointCollection

A collection of Point structures that describes the vertex points of the polygon. The default is null. The value can be expressed as a string for XAML or type conversion.

Attributes

PointsProperty PointsProperty PointsProperty

Identifies the Points dependency property.

public : static DependencyProperty PointsProperty { get; }public static DependencyProperty PointsProperty { get; }Public Static ReadOnly Property PointsProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Points dependency property.

Attributes

See Also