2015年12月17日 星期四

猜拳(資料庫失敗)

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 WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int com = 0;
        Random rnd = new Random();
        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.ReadOnly = true;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            com = rnd.Next(1, 4);
            if (com == 1)
                textBox1.Text = "電腦出剪刀,平手";
            else if (com == 2)
                textBox1.Text = " 電腦出石頭,lose";
            else if (com == 3)
                textBox1.Text = "電腦出布,win";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            com = rnd.Next(1, 4);
            if (com == 1)
                textBox1.Text = "電腦出剪刀,win";
            else if (com == 2)
                textBox1.Text = " 電腦出石頭,平手";
            else if (com == 3)
                textBox1.Text = "電腦出布,lose";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            com = rnd.Next(1, 4);
            if (com == 1)
                textBox1.Text = "電腦出剪刀,lose";
            else if (com == 2)
                textBox1.Text = " 電腦出石頭,win";
            else if (com == 3)
                textBox1.Text = "電腦出布,平手";
        }

        private void bindingSource1_CurrentChanged(object sender, EventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}

沒有留言:

張貼留言