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 r1 = 0;
int r2 = 0;
int r3 = 0;
int r4 = 0;
int r5 = 0;
int r6 = 0;
int r7 = 0;
int r8 = 0;
int r9 = 0;
public Form1()
{
InitializeComponent();
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
button5.Enabled = false;
button6.Enabled = false;
button7.Enabled = false;
button8.Enabled = false;
button9.Enabled = false;
}
private void button10_Click(object sender, EventArgs e)
{
Random rnd = new Random();
int[] a = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
for (int i = 0; i < 9; ++i)
{
int j = rnd.Next(8);
int t = a[j];
a[j] = a[i];
a[i] = t;
}
button1.Text = a[0].ToString();
button2.Text = a[1].ToString();
button3.Text = a[2].ToString();
button4.Text = a[3].ToString();
button5.Text = a[4].ToString();
button6.Text = a[5].ToString();
button7.Text = a[6].ToString();
button8.Text = a[7].ToString();
button9.Text = a[8].ToString();
//button10.Enabled = false;
}
}
}
沒有留言:
張貼留言