2014年12月7日 星期日

10/24圈叉遊戲
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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
int count = 1;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
button1.Text = "";
button2.Text = "";
button3.Text = "";
button4.Text = "";
button5.Text = "";
button6.Text = "";
button7.Text = "";
button8.Text = "";
button9.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1)
{
button1.Text = "o";
}
else if (r == 0)
{
button1.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button1.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1)
{
button2.Text = "o";
}
else if (r == 0){
button2.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button2.Enabled = false;
}
private void button3_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1){
button3.Text = "o";
}
else if (r == 0)
{
button3.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button3.Enabled = false;
}
private void button4_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1)
{
button4.Text = "o";
}
else if (r == 0){
button4.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button4.Enabled = false;
}
private void button5_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1)
{
button5.Text = "o";
}
else if (r == 0)
{
button5.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button5.Enabled = false;
}
private void button6_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1){
button6.Text = "o";
}
else if (r == 0)
{
button6.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button6.Enabled = false;
}
private void button7_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1)
{
button7.Text = "o";
}
else if (r == 0)
{
button7.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button7.Enabled = false;
}
private void button8_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1)
{
button8.Text = "o";
}
else if (r == 0)
{
button8.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button8.Enabled = false;
}
private void button9_Click(object sender, EventArgs e)
{
int r;
r = count % 2;
if (r == 1)
{
button9.Text = "o";
}
else if (r == 0)
{
button9.Text = "x";
}
textBox1.Text = Convert.ToString(r);
count++;
button9.Enabled = false;
}
}
}

0 個意見:

張貼留言

訂閱 張貼留言 [Atom]

<< 首頁