close

1413533218-1837689998_n  

 

 

=================================================================================

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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int d1, d2;
Random ran = new Random();
d1 = ran.Next(1, 7);
d2 = ran.Next(1, 7);
label1.Text = Convert.ToString(d1);
label2.Text = Convert.ToString(d2);
for (int k = 1; k <= d1 + d2; k++)
{
Thread.Sleep(1000);
Application.DoEvents();
button3.Left = button3.Left + k * 10;
if (button3.Left >= 500) { MessageBox.Show("你贏了"); }
}

}

private void button2_Click(object sender, EventArgs e)
{
int d1, d2;
Random ran = new Random();
d1 = ran.Next(1, 7);
d2 = ran.Next(1, 7);
label1.Text = Convert.ToString(d1);
label2.Text = Convert.ToString(d2);
for (int k = 1; k <= d1 + d2; k++)
{
Thread.Sleep(1000);
Application.DoEvents();
button4.Left = button4.Left + k * 10;

if (button4.Left >= 500) { MessageBox.Show("你贏了"); }
}

}
}
}

arrow
arrow
    全站熱搜

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