close






using System;
sing 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
    {
        Button[,] Buttons = new System.Windows.Forms.Button[5, 5];
        int[] randomize = new int[5];                //宣告一個一維陣列  (用來存取變數的陣列)
        Random rnd = new Random();   
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            for (int i = 1; i < 5; i++)
            {
                for (int 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 pro = 0, a = 0, b = 0, c = 0;
             for (int i = 1; i < 5; i++)
            {
                for (int j = 1; j < 5; j++)
                {
                    pro = i ;
                    a = i + 4;
                    b = i + 8;
                    c = i + 12;
                    Buttons[i, 1].Text = pro.ToString();
                    Buttons[i, 2].Text = a.ToString();
                    Buttons[i, 3].Text = b.ToString();
                    Buttons[i, 4].Text = c.ToString();
                }
            }


        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }
    }
}


arrow
arrow
    全站熱搜

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