Polygon 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// This API is not available in Javascript.
<Polygon .../>
- Inheritance
- Attributes
| 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
Properties
FillRule 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// This API is not available in Javascript.
<Polygon FillRule="Nonzero"/>
-or-
<Polygon FillRule="EvenOdd"/>
Remarks
See the FillRule enumeration for more info.
FillRuleProperty 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// This API is not available in Javascript.
The identifier for the FillRule dependency property.
Points 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// This API is not available in Javascript.
<Polygon Points="pointSet"/>
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.
PointsProperty 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// This API is not available in Javascript.
The identifier for the Points dependency property.