Esempio n. 1
0
        private void DrawSquare(Square square, bool selected = false)
        {
            using (var lg = this.Image.GetGraphics())
            {
                var g = lg.Graphics;
                var rect = square.GetRectangle();
                g.DrawImageUnscaled(Images.GetSquareImage(square, this.Board[square]), rect);

                if (square.GetColumn() == 1)
                {
                    var loc = rect.Location;
                    loc.Offset(-15, 40);
                    //g.DrawString(square.GetRank().ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.White, loc);
                }

                if (square.GetRank() == 1)
                {
                    var loc = rect.Location;
                    loc.Offset(40, 105);
                    //g.DrawString(((char)('a' + (square.GetColumn() - 1))).ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.White, loc);
                }

                if (selected)
                {
                    rect.Width -= 3;
                    rect.Height -= 3;
                    g.DrawRectangle(new Pen(Brushes.Green, 3), rect);
                }
            }

            this.Invalidate(square.GetRectangle());
        }