using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
int a;
Button[,] buttons = new Button[10, 10];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 1; i < 10; i++)
{
for (int j = 1; j < 10; j++)
{
buttons[i, j] = new Button();
this.Controls.Add(buttons[i,j]);
buttons[i, j].Size = new Size(50, 50);
a = i * j;
buttons[i, j].Text = Convert.ToString(a);
buttons[i, j].Location = new Point(i * 50, j * 50);
}
}
}
}
}
沒有留言:
張貼留言