close

12399079_1021702647850257_646609643_n.jpg 

12399181_1021702641183591_710351539_n.jpg 


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 WindowsFormsApplication9

{

public partial class Form1 : Form

    {

int i = 0;

public Form1()

        {

            InitializeComponent();

        }

private void timer1_Tick(object sender, EventArgs e)

        {

if(i == 0)

            {

                pictureBox1.Image = Properties.Resources._03;

                i++;

            }

else if(i == 1)

            {

                pictureBox1.Image = Properties.Resources._02;

                i++;

            }

else if(i == 2)

            {

                pictureBox1.Image = Properties.Resources._01;

                i = 0;

            }

        }

private void button1_Click(object sender, EventArgs e)

        {

            winOrNot(1);

        }

private void button2_Click(object sender, EventArgs e)

        {

            winOrNot(2);

        }

private void button3_Click(object sender, EventArgs e)

        {

            winOrNot(3);

        }

private void winOrNot(int j)

        {

            pictureBox1.Show();

string time = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();

string win = "";

            timer1.Enabled = false;

if((i == 1 && j == 2) || (i == 2 && j == 3) || (i == 0 && j == 1))

            {

MessageBox.Show("WIN!!  Time: " + time);

                win = "win";

                textBox1.Text = win;

                textBox2.Text = time;

                textBox3.Text = (testBindingSource2.Count).ToString();

                testBindingSource2.AddNew();

            }

else if((i == j) || (i == 0 && j == 3))

            {

MessageBox.Show("TIE!!  Time: " + time);

                win = "tie";

                textBox1.Text = win;

                textBox2.Text = time;

                textBox3.Text = (testBindingSource2.Count).ToString();

                testBindingSource2.AddNew();

            }

else

            {

MessageBox.Show("LOSE!!  Time: " + time);

                win = "lose";

                textBox1.Text = win;

                textBox2.Text = time;

                textBox3.Text = (testBindingSource2.Count).ToString();

                testBindingSource2.AddNew();

            }

            textBox1.Text = "";

            textBox2.Text = "";

            textBox3.Text = "";

            timer1.Enabled = true;

            pictureBox1.Hide();

        }

private void Form1_Load(object sender, EventArgs e)

        {

// TODO: This line of code loads data into the 'database3DataSet2.test' table. You can move, or remove it, as needed.

this.testTableAdapter2.Fill(this.database3DataSet2.test);

            textBox1.DataBindings.Add("Text", testBindingSource2, "win");

            textBox2.DataBindings.Add("Text", testBindingSource2, "time");

            textBox3.DataBindings.Add("Text", testBindingSource2, "識別碼");

            pictureBox1.Hide();

        }

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)

        {

        }

private void textBox1_TextChanged(object sender, EventArgs e)

        {

        }

private void textBox2_TextChanged(object sender, EventArgs e)

        {

        }

private void textBox3_TextChanged(object sender, EventArgs e)

        {

        }

private void pictureBox1_Click(object sender, EventArgs e)

        {

        }

private void label1_Click(object sender, EventArgs e)

        {

        }

    }

}

arrow
arrow
    全站熱搜

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