Skip to content
Snippets Groups Projects
Commit 3ae4edf8 authored by Hanna Johansson's avatar Hanna Johansson
Browse files

Update Form1.cs so that color change for winning row, only occurs once (outside loop)

parent 0874d1b7
Branches main
No related tags found
No related merge requests found
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
......@@ -148,12 +148,12 @@ namespace TicTactoe
private void WON(string XO, Control A, Control B, Control C)
{
label1.Text = XO + " Wins";
A.BackColor = System.Drawing.Color.Tomato;
B.BackColor = System.Drawing.Color.Tomato;
C.BackColor = System.Drawing.Color.Tomato;
foreach (Control x in this.Controls)
{
A.BackColor = System.Drawing.Color.Tomato;
B.BackColor = System.Drawing.Color.Tomato;
C.BackColor = System.Drawing.Color.Tomato;
if (x is Button && x.Tag == "play")
{
((Button)x).Enabled = false; // disable all buttons - it is no longer possible to play when someone has won
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment