2014年11月13日 星期四

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 WindowsFormsApplication6
{
    public partial class Form1 : Form
    {
       
        //System.Windows.Forms.Button Button1;
        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();
                    buttons[i, j].Size = new Size(50, 50);
                    buttons[i, j].Location = new Point(i * 50, j * 50);
                    int X;
                    X = i * j;
                    buttons[i, j].Text = Convert.ToString(X);
                    this.Controls.Add(buttons[i, j]);
                }
                }

        }
        private void Button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("hello");
        }


    }
}