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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
//System.Windows.Forms.Button Button1;
//System.Windows.Forms.Button[] Buttons;
Button[,] buttons = new Button[4, 4];
int c = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Button1 = new System.Windows.Forms.Button();
//Button1.Location = new Point(100, 100);
//Button1.Size = new Size(100, 100);
//Button1.Click += new System.EventHandler(Button1_Click);
//Buttons[,]=new System.Windows.Forms.Button[];
mouse_Click();
}
private void mouse_Click()
{
for (int i = 1; i < 4; i++)
{
for (int j = 1; j < 4; j++)
{
buttons[i, j] = new Button();
buttons[i, j].Location = new Point(100 + i * 50, j * 50);
buttons[i, j].Size = new Size(50, 50);
//buttons[i, j].Text = (i*j).ToString();
this.Controls.Add(buttons[i, j]);
int r;
c = c + 1;
r = c % 2;
buttons[i, j].Text = Convert.ToString(r);
if (r == 0)
{
buttons[i, j].Text = "O";
}
else
{
buttons[i, j].Text = "X";
}
}
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
//System.Windows.Forms.Button Button1;
//System.Windows.Forms.Button[] Buttons;
Button[,] buttons = new Button[4, 4];
int c = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Button1 = new System.Windows.Forms.Button();
//Button1.Location = new Point(100, 100);
//Button1.Size = new Size(100, 100);
//Button1.Click += new System.EventHandler(Button1_Click);
//Buttons[,]=new System.Windows.Forms.Button[];
mouse_Click();
}
private void mouse_Click()
{
for (int i = 1; i < 4; i++)
{
for (int j = 1; j < 4; j++)
{
buttons[i, j] = new Button();
buttons[i, j].Location = new Point(100 + i * 50, j * 50);
buttons[i, j].Size = new Size(50, 50);
//buttons[i, j].Text = (i*j).ToString();
this.Controls.Add(buttons[i, j]);
int r;
c = c + 1;
r = c % 2;
buttons[i, j].Text = Convert.ToString(r);
if (r == 0)
{
buttons[i, j].Text = "O";
}
else
{
buttons[i, j].Text = "X";
}
}
}
}
}
}
沒有留言:
張貼留言