小编use*_*714的帖子

如何绘制多边形?(在C#WPF项目中)

点击我想从图像上的多边形区域制作的点.

myPolygon = new Polygon();
myPolygon.Stroke = Brushes.Black; 
myPolygon.Fill = Brushes.LightYellow; 
myPolygon.StrokeThickness = 2; 
myPolygon.HorizontalAlignment = HorizontalAlignment.Left; 
myPolygon.VerticalAlignment = VerticalAlignment.Center; 
myPolygon.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(Polygon_MouseDown); 
myPolygon.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(Polygon_MouseUp);     

private void Polygon_MouseDown(object sender, MouseButtonEventArgs e) 
{     
    Point p = e.GetPosition(image); 
    myPolygon.Points = new PointCollection() { new Point(p.X,p.Y) };
    RootCanvas.Children.Add(myPolygon); 
} //MouseClick Event BUT, did not click behavior.. I want draw a line along the points.
Run Code Online (Sandbox Code Playgroud)

我能怎么做...?

c# wpf polygon polyline

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

polygon ×1

polyline ×1

wpf ×1