This is what I have done so far.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace game.casestudy
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void objectiveToolStripMenuItem_Click(object sender, EventArgs e)
{
Form Ronald = new Form3();
Ronald.Show();
}
private void closeGameToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void newGameToolStripMenuItem_Click(object sender, EventArgs e)
{
Form Ronald = new Form2();
Ronald.Show();
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button1.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button1.Enabled = false;
}
else
{
button1.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button1.Enabled = false;
}
{
if (label1.Enabled == true)
{
button1.Text = "X";
button2.Text = "X";
button3.Text = "X";
MessageBox.Show("Player1 wins!");
}
else
{
MessageBox.Show("Player2 wins!");
}
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button2.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button2.Enabled = false;
}
else
{
button2.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button2.Enabled = false;
}
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button3.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button3.Enabled = false;
}
else
{
button3.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button3.Enabled = false;
}
}
private void button4_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button4.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button4.Enabled = false;
}
else
{
button4.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button4.Enabled = false;
}
}
private void button5_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button5.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button5.Enabled = false;
}
else
{
button5.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button5.Enabled = false;
}
}
private void button6_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button6.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button6.Enabled = false;
}
else
{
button6.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button6.Enabled = false;
}
}
private void button7_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button7.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button7.Enabled = false;
}
else
{
button7.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button7.Enabled = false;
}
}
private void button8_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button8.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button8.Enabled = false;
}
else
{
button8.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button8.Enabled = false;
}
}
private void button9_Click(object sender, EventArgs e)
{
if (label1.Enabled == true)
{
button9.Text = "X";
label1.Enabled = false;
label2.Enabled = true;
button9.Enabled = false;
}
else
{
button9.Text = "O";
label1.Enabled = true;
label2.Enabled = false;
button9.Enabled = false;
}
}
private void Form2_Load(object sender, EventArgs e)
{
}
}
}