public void DrawChessBoard()
{
canva.Height = 450;
canva.Width = 450;
canva.Margin = new Thickness(0, 0, 0, 0);
for (int i = 0; i <= 15; i++)
{
DrawingLine(new Point(0, i * 30), new Point(450, i * 30));
DrawingLine(new Point(i * 30, 0), new Point(i * 30, 450));
}
canva.IsEnabled = true;
return;
}
private void DrawingLine(Point Sp, Point Ep)
{
LineGeometry linegemetry = new LineGeometry();
linegemetry.StartPoint = Sp;
linegemetry.EndPoint = Ep;
Path mypath = new Path();
mypath.Stroke = Brushes.Black;
mypath.StrokeThickness = 1;
mypath.Data = linegemetry;
canva.Children.Add(mypath);
return;
}
WPF绘制五子棋盘
最新推荐文章于 2022-11-29 11:58:10 发布