close

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace _145354
{
public partial class Form1 : Form
{
int ssum1 = 0,ssum2=0;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int d1, d2,dsum1;
Random irand = new Random();
d1 = irand.Next(1, 7);
d2 = irand.Next(1, 7);
label1.Text = Convert.ToString(d1);
label2.Text = Convert.ToString(d2);
dsum1=d1+d2;
ssum1 = ssum1+ dsum1;
textBox1.Text = Convert.ToString(ssum1);
for (int i = 1; i <= dsum1; i++)
{
button2.Left = i + ssum1;
Thread.Sleep(100);
Application.DoEvents();

}
while (ssum1 >= 20)
MessageBox.Show("黑王獲勝");
}

private void button3_Click(object sender, EventArgs e)
{
int d1, d2, dsum2;
Random irand = new Random();
d1 = irand.Next(1, 7);
d2 = irand.Next(1, 7);
label3.Text = Convert.ToString(d1);
label4.Text = Convert.ToString(d2);
dsum2 = d1 + d2;
ssum2 = ssum2 + dsum2;
textBox2.Text = Convert.ToString(ssum2);
for (int i = 1; i <= dsum2; i++)
{
button4.Left = i + ssum2;
Thread.Sleep(100);
Application.DoEvents();
}

while (ssum2 >= 20)
MessageBox.Show("白王獲勝");
}
}
}

馬  

arrow
arrow
    全站熱搜

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