2015年10月26日 星期一

數字拉霸

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 WindowsFormsApplication4
{  
    public partial class Form1 : Form
    {
        int c = 0, d=1,f,qq =0,qaq=0;
        public Form1()
        {
            InitializeComponent();
        }
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (qaq == 0)
            {
                qq = 0;
                button10.Text = "按我開死";
                button11.Text = "勝負";
            }
        }
        private void button10_Click(object sender, EventArgs e)
        {

            qaq = 1;
            d++;
            f = d % 2;
            if (f == 0&& qq==0)
            {
                timer1.Enabled = true;
                button10.Text = "stop me";
            }
            else if (f ==1&qq== 0)
            {
                timer1.Enabled = false;
                button10.Text = "繼續開死";
                button11.Text = "勝負";
            }
            if (qq==3)
            {
                timer1.Enabled = true;
               // qaq = 0;//
            }

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Random rnd = new Random();
            int s = rnd.Next(1, 11);
            int t = rnd.Next(1,11);
            int u = rnd.Next(1, 11);

            if (qq == 0)
            {
                button1.Text = s.ToString();
                button4.Text = t.ToString();
                button7.Text = u.ToString();
            }

            qq = qq + 1;
            if (qq == 1)
            {
                s = s - 1;
                t = t - 1;
                u = u - 1;
                button2.Text = s.ToString();
                button5.Text = t.ToString();
                button8.Text = u.ToString();
            }
            qq = qq + 1;
            if (qq == 2)
            {
                s = s + 2;
                t = t + 2;
                u = u + 2;
                button3.Text = s.ToString();
                button6.Text = t.ToString();
                button9.Text = u.ToString();
                qq = qq - 2;
            }
            if (s == t && t == u)
            {
                button10.Text = "reset";
                button11.Text = "ㄋ營ㄌ";
                timer1.Enabled = false;
            }
        }
             
                }
            }

沒有留言:

張貼留言