Polygon.Points Eigenschaft

Definition

Ruft eine Auflistung ab, die die Vertexpunkte des Polygons enthält, oder legt diese fest.

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

Eigenschaftswert

Eine Auflistung von Point-Strukturen, die die Vertexpunkte des Polygons beschreiben. Der Standardwert ist ein NULL-Verweis (Nothing in Visual Basic).

Beispiele

Das folgende Beispiel zeigt, wie Sie ein Polygon -Element erstellen und die Points -Eigenschaft mithilfe von Code festlegen.


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

Hinweise

Verwenden Sie in Extensible Application Markup Language (XAML) eine durch Leerzeichen getrennte Liste von kommagetrennten x-Koordinaten- und y-Koordinatenpaaren, um dieses Attribut festzulegen. Verwenden Sie die einfache Notation, d. h x1,y1 x2,y2 ... xn,yn. .

Informationen zur Abhängigkeitseigenschaft

Bezeichnerfeld PointsProperty
Metadateneigenschaften auf true festgelegt AffectsRender, AffectsMeasure

Gilt für:

Weitere Informationen