close
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        int i = 1, j = 1;
        
        Button[,] Buttons = new System.Windows.Forms.Button[16, 16];
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            for (i = 1; i < 5; i++)
            {
                for (j = 1; j < 5; j++)
                {
                    
                    Buttons[i, j] = new Button();
                    Buttons[i, j].Size = new Size(50, 50);
                    Buttons[i, j].Location = new Point(i * 50, j * 50);
                    this.Controls.Add(Buttons[i, j]);//出現在畫面中
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int a = 0;          
            for (i = 1; i < 5; i++)
            {
                for (j = 1; j < 5; j++)
                {
                    a = (i - 1) * 4 + j;
                    Buttons[i, j].Text = a.ToString();
                }
            }
        }
    }
}
arrow
arrow
    文章標籤
    123
    全站熱搜
    創作者介紹
    創作者 ic3ic8 的頭像
    ic3ic8

    ic3ic8的部落格

    ic3ic8 發表在 痞客邦 留言(0) 人氣()