Polyline.Points 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置包含 Polyline 的顶点的集合。
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
属性值
用于描述 Polyline 的顶点的 Point 结构的集合。 默认为空引用(在 Visual Basic 中为 Nothing
)。
示例
以下示例演示如何使用代码创建 Polyline 元素并设置 Points 属性。
// Add the Polyline Element
myPolyline = gcnew Polyline();
myPolyline->Stroke = Brushes::SlateGray;
myPolyline->StrokeThickness = 2;
myPolyline->FillRule = FillRule::EvenOdd;
Point Point4 = Point(1, 50);
Point Point5 = Point(10, 80);
Point Point6 = Point(20, 40);
PointCollection^ myPointCollection2 = gcnew PointCollection();
myPointCollection2->Add(Point4);
myPointCollection2->Add(Point5);
myPointCollection2->Add(Point6);
myPolyline->Points = myPointCollection2;
myGrid->Children->Add(myPolyline);
// Add the Polyline Element
myPolyline = new Polyline();
myPolyline.Stroke = System.Windows.Media.Brushes.SlateGray;
myPolyline.StrokeThickness = 2;
myPolyline.FillRule = FillRule.EvenOdd;
System.Windows.Point Point4 = new System.Windows.Point(1, 50);
System.Windows.Point Point5 = new System.Windows.Point(10, 80);
System.Windows.Point Point6 = new System.Windows.Point(20, 40);
PointCollection myPointCollection2 = new PointCollection();
myPointCollection2.Add(Point4);
myPointCollection2.Add(Point5);
myPointCollection2.Add(Point6);
myPolyline.Points = myPointCollection2;
myGrid.Children.Add(myPolyline);
' Add a Polyline Element
Dim myPolyline As New Polyline()
myPolyline.Stroke = Brushes.SlateGray
myPolyline.StrokeThickness = 2
myPolyline.FillRule = FillRule.EvenOdd
Dim Point4 As New System.Windows.Point(1, 50)
Dim Point5 As New System.Windows.Point(10, 80)
Dim Point6 As New System.Windows.Point(20, 40)
Dim myPointCollection2 As New PointCollection()
myPointCollection2.Add(Point4)
myPointCollection2.Add(Point5)
myPointCollection2.Add(Point6)
myPolyline.Points = myPointCollection2
myGrid.Children.Add(myPolyline)
注解
在可扩展应用程序标记语言 (XAML) 中,使用逗号分隔的 x 坐标和 y 坐标对的空格分隔列表来设置此属性。 使用简单的表示法,即 x1,y1 x2,y2 ... xn,yn
。
依赖项属性信息
标识符字段 | PointsProperty |
元数据属性设置为 true |
AffectsRender, AffectsMeasure |