i work in visual studio on dots & boxes game, i make an array of dots in 4 rows and 4 column, and i draw lines between each two points, now i want when player1 click on one line, specific line change color to red, player2 click on other line, it change color to black.
private void panel1_Paint(object sender, PaintEventArgs e)
{
Pen mypen = new Pen(Color.Blue, 2);
e.Graphics.FillRectangle(Brushes.Green, 0, 0, 250, 250);
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
e.Graphics.FillEllipse(Brushes.Black, 32 + 48 * j, 32 + 48 * i, 10, 10);
}
}
for (int i = 0; i <= 3; i++)
{
for (int j = 0; j <= 3; j++)
{
e.Graphics.DrawLine(mypen, 37 + 48 * j, 37 + 48 * i, 37 + 48 * j, 37 + 48 * (i + 1));
e.Graphics.DrawLine(mypen, 37 + 48 * j, 37 + 48 * i, 37 + 48 * (j + 1), 37 + 48 * i);
}
}
}
i expected when click on line change the color