Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.97 KB

polygon.md

File metadata and controls

59 lines (40 loc) · 1.97 KB
-api-id -api-type
T:Windows.UI.Xaml.Shapes.Polygon
winrt class

Windows.UI.Xaml.Shapes.Polygon

-description

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

-xaml-syntax

<Polygon .../>

-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.

-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>

-see-also

Shape, XAML vector-based drawing sample, Draw shapes