下面的代码是 Microsoft 生成折线的示例。我已经实现了这个,但它不起作用。
我的问题是:使“myPolyline”对象显示的方法是什么?代码的最后一行是myGrid.Children.Add(myPolyline)
,我不明白哪个对象应该被命名为“myGrid”,也许我的问题的答案与此有关。
' 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)