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