Polygon.Points Propiedad

Definición

Obtiene o establece una colección que contiene los puntos de vértice del polígono.

public:
 property System::Windows::Media::PointCollection ^ Points { System::Windows::Media::PointCollection ^ get(); void set(System::Windows::Media::PointCollection ^ value); };
public System.Windows.Media.PointCollection Points { get; set; }
member this.Points : System.Windows.Media.PointCollection with get, set
Public Property Points As PointCollection

Valor de propiedad

Colección de estructuras Point que describen los puntos de vértice del polígono. El valor predeterminado es una referencia nula (Nothing en Visual Basic).

Ejemplos

En el ejemplo siguiente se muestra cómo crear un Polygon elemento y establecer la Points propiedad mediante código.


//Add the Polygon Element
myPolygon = gcnew Polygon();
myPolygon->Stroke = Brushes::Black;
myPolygon->Fill = Brushes::LightSeaGreen;
myPolygon->StrokeThickness = 2;
myPolygon->HorizontalAlignment = HorizontalAlignment::Left;
myPolygon->VerticalAlignment = VerticalAlignment::Center;
Point Point1 = Point(1, 50);
Point Point2 = Point(10, 80);
Point Point3 = Point(50, 50);
PointCollection^ myPointCollection = gcnew PointCollection();
myPointCollection->Add(Point1);
myPointCollection->Add(Point2);
myPointCollection->Add(Point3);
myPolygon->Points = myPointCollection;
myGrid->Children->Add(myPolygon);

//Add the Polygon Element
myPolygon = new Polygon();
myPolygon.Stroke = System.Windows.Media.Brushes.Black;
myPolygon.Fill = System.Windows.Media.Brushes.LightSeaGreen;
myPolygon.StrokeThickness = 2;
myPolygon.HorizontalAlignment = HorizontalAlignment.Left;
myPolygon.VerticalAlignment = VerticalAlignment.Center;
System.Windows.Point Point1 = new System.Windows.Point(1, 50);
System.Windows.Point Point2 = new System.Windows.Point(10,80);
System.Windows.Point Point3 = new System.Windows.Point(50,50);
PointCollection myPointCollection = new PointCollection();
myPointCollection.Add(Point1);
myPointCollection.Add(Point2);
myPointCollection.Add(Point3);
myPolygon.Points = myPointCollection;
myGrid.Children.Add(myPolygon);

' Add a Polygon Element
Dim myPolygon As New Polygon()
myPolygon.Stroke = Brushes.Black
myPolygon.Fill = Brushes.LightSeaGreen
myPolygon.StrokeThickness = 2
myPolygon.HorizontalAlignment = HorizontalAlignment.Left
myPolygon.VerticalAlignment = VerticalAlignment.Center
Dim Point1 As New System.Windows.Point(1, 50)
Dim Point2 As New System.Windows.Point(10, 80)
Dim Point3 As New System.Windows.Point(50, 50)
Dim myPointCollection As New PointCollection()
myPointCollection.Add(Point1)
myPointCollection.Add(Point2)
myPointCollection.Add(Point3)
myPolygon.Points = myPointCollection
myGrid.Children.Add(myPolygon)

Comentarios

En Lenguaje de marcado de aplicación extensible (XAML), usa una lista delimitada por espacios de pares de coordenadas x y coordenadas separados por comas para establecer este atributo. Use notación simple, es decir, x1,y1 x2,y2 ... xn,yn.

Información sobre propiedades de dependencia

Campo identificador PointsProperty
Propiedades de metadatos establecidas en true AffectsRender, AffectsMeasure

Se aplica a

Consulte también