using System;
using System.Drawing;
using System.Windows.Forms;
namespace Game99
{
public partial class Form1 : Form
{
Button[,] buttons = new Button[10, 10];
int emptyRow = 9;
int emptyCol = 9;
public Form1()
{
InitializeComponent();
CreateGrid();
}
void CreateGrid()
{
int number = 1;
int size = 50;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
Button btn = new Button();
btn.Size = new Size(size, size);
btn.Location = new Point(j * size, i * size);
if (number <= 99)
{
btn.Text = number.ToString();
}
else
{
btn.Text = "";
}
btn.Click += Button_Click;
buttons[i, j] = btn;
gamePanel.Controls.Add(btn);
number++;
}
}
}