拉霸機


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 a1 = 0, d1, randnum1 = 10, randnum2 = 10, randnum3 = 10;
        int a2 = 0, d2, a3 = 0, d3;
        public Form1()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            a1++;
            d1 = a1 % 10;
            if (a1 >= randnum1)
            {
                timer1.Enabled = false;
            }
            button1.Text = d1.ToString();
            if ((randnum1 == randnum2) && (randnum2 == randnum3))
                MessageBox.Show("Win");
        }

        private void button1_Click(object sender, EventArgs e)
        {
       

        }

        private void button4_Click(object sender, EventArgs e)
        {
            a1 = 0;
            a2 = 0;
            a3 = 0;
            timer1.Enabled = true;
            timer2.Enabled = true;
            timer3.Enabled = true;
            Random rnd = new Random();
            randnum1 = rnd.Next(1, 10);
            randnum2 = rnd.Next(1, 10);
            randnum3 = rnd.Next(1, 10);
            //randnum2 = randnum1 + randnum2;
            //randnum3 = randnum1 + randnum2 + randnum3;
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            a2++;
            d2 = a2 % 10;
            if (a2 >= randnum2)
            {
                timer2.Enabled = false;
            }
            button2.Text = d2.ToString();
        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            a3++;
            d3 = a3 % 10;
            if (a3 >= randnum3)
            {
                timer3.Enabled = false;
            }
            button3.Text = d3.ToString();
        }

        private void timer4_Tick(object sender, EventArgs e)
        {

        }

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

 

arrow
arrow
    全站熱搜

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