close

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 WindowsFormsApplication10
{
public partial class Form1 : Form
{
Button[,] buttons = new Button[3, 3];
int c;
public Form1()
{
InitializeComponent();
}
static private int[,] WinGroup = new int[8, 3]
{
{0,1,2},{3,4,5},{6,7,8},
{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}

 

};
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
buttons[i, j] = new Button();
buttons[i, j].Size = new Size(80, 80);
buttons[i, j].Location = new Point(i * 85, j * 85);
this.Controls.Add(buttons[i, j]);
buttons[i, j].Click += new System.EventHandler(this.Button_Click);
}
}
}
protected void Button_Click(object sender, EventArgs e)
{
Button buttons = sender as Button;
int r;
c = c + 1;
r = c % 2;
if (r == 0)
{
buttons.Text = "0";
}
else
{
buttons.Text = "X";
}
buttons.Enabled = false;
}


}
}

arrow
arrow
    全站熱搜

    p06299995 發表在 痞客邦 留言(0) 人氣()