WPF绘制五子棋盘

2017-06-12 18:59:29来源:CSDN作者:L524922464人点击

        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;        }

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台