コード例 #1
0
        private void DrawSpot(Spot spot, Color colour, PaintEventArgs e)
        {
            float x;
            float y;

            if (spot == null)
            {
                return;
            }

            x = spot.Column * boxSideLength;
            y = spot.Row * boxSideLength;

            if (rbSquares.Checked)
            {
                e.Graphics.FillRectangle(new SolidBrush(colour), x + 1, y + 1, boxSideLength - 1, boxSideLength - 1);
            }
            else
            {
                e.Graphics.FillEllipse(new SolidBrush(colour), x + 2, y + 2, boxSideLength - 4, boxSideLength - 4);
            }
        }
コード例 #2
0
        private void DrawLine(Spot fromSpot, Spot toSpot, PaintEventArgs e)
        {
            float x1;
            float y1;
            float x2;
            float y2;

            if (fromSpot == null)
            {
                return;
            }

            x1 = fromSpot.Column * boxSideLength;
            y1 = fromSpot.Row * boxSideLength;

            x2 = toSpot.Column * boxSideLength;
            y2 = toSpot.Row * boxSideLength;

            Pen pen = new Pen(Color.Brown, 4);

            e.Graphics.DrawLine(pen, x1 + boxSideLength / 2, y1 + boxSideLength / 2, x2 + boxSideLength / 2, y2 + boxSideLength / 2);
            // e.Graphics.FillRectangle(new SolidBrush(colour), x + 1, y + 1, boxSideLength - 1, boxSideLength - 1);
        }
コード例 #3
0
ファイル: Spot.cs プロジェクト: Brewster35/thecodingtrain
 public void AddNeighbour(Spot spot)
 {
     neighbours.Add(spot);
 }
コード例 #4
0
 public void SetEnd(int row, int column)
 {
     end = grid[row + column * totalColumnsInMap];
 }