2015年10月16日 星期五

拉霸

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 c = 0, d = 0, a1,a2,a3;
         
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Random rnd = new Random(Guid.NewGuid().GetHashCode());
            a1 = rnd.Next(1, 3);
            a2 = rnd.Next(1, 3);
            a3 = rnd.Next(1, 3);
            button1.Text = a1.ToString();
            button2.Text = a2.ToString();
            button3.Text = a3.ToString();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            c = c + 1;
            d = c % 2;
            if (d == 0) timer1.Enabled = true;
            else timer1.Enabled = false;
            button4.Text = d.ToString();
         
        }
        private void button5_Click_1(object sender, EventArgs e)
        {

        }

        private void timer2_Tick(object sender, EventArgs e)
        {
           if (a1 == a2 && a2 == a3 && a3 == a1 )
               button5.Text = "WIN";

        }
    }
}

沒有留言:

張貼留言