123.png 
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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {

        int a=3, b;
        int[] rand = new int[9];
        Button[,]buttons=new Button[3,3];
        Random randomc1 = new Random(Guid.NewGuid().GetHashCode());

        public Form1()
        {
            InitializeComponent();


        }

        private void Form1_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 3; ++i)
            {

                for (int j = 0; j < 3; ++j)
                {
                    buttons[i, j] = new Button();                 
                    buttons[i, j].Location = new Point(i * 80, j * 80);     
                    buttons[i, j].Size = new Size(80, 80);           

                    this.Controls.Add(buttons[i, j]);     

                }
            }
        }

        private void button10_Click(object sender, EventArgs e)
        {
            請投金幣.Enabled = true;
            拉下.Enabled = false;
            for (int i = 0; i < 9; i++)
            {

                rand[i] = randomc1.Next(1, 10);       

                for (int j = 0; j < i; j++)
                {
                    while (rand[j] == rand[i])    
                    {
                        j = 0;
                        rand[i] = randomc1.Next(1, 10);
                    }
                }
            }

            for ( int i = 0; i < 3; ++i)
            {

                for (int j = 0; j < 3; ++j)
                {
                    buttons[i, j].Text = Convert.ToString(rand[i *3 + j]);       
  
                }
            }
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            
        }

        private void button11_Click(object sender, EventArgs e)
        {
            請投金幣.Text = "請投金幣";
            拉下.Enabled = true;
            請投金幣.Enabled = false;
        }
    }
}


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 a29yly1111 的頭像
    a29yly1111

    a29yly1111的部落格

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