拉霸
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
int c1 = 0, b1 = 0;
int c2 = 0, b2 = 0;
int c3 = 0, b3 = 0;
int rndmoney1 = 100;
int rndmoney2 = 100;
int rndmoney3 = 100;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
if (c1 >= rndmoney1) timer1.Enabled = false;
{
}
if (b1 == 0)
{
//button1.BackColor = Color.Green;
//button2.BackColor = Color.Black;
//button3.BackColor = Color.Black;
}
else if (b1 == 1)
{
//button1.BackColor = Color.Black;
//button2.BackColor = Color.Yellow;
// button3.BackColor = Color.Black;
}
else if (b1 == 2)
{
//button1.BackColor = Color.Black;
// button2.BackColor = Color.Black;
// button3.BackColor = Color.Red;
}
c1 = c1 + 1;
b1 = c1 % 3;
button1.Text = c1.ToString();
}
private void button4_Click(object sender, EventArgs e)
{
c1 = 0;
c2 = 0;
c3 = 0;
timer1.Enabled = true;
timer2.Enabled = true;
timer3.Enabled = true;
Random rnd = new Random();
rndmoney1 = rnd.Next(1, 10);
rndmoney2 = rnd.Next(1, 10);
rndmoney3 = rnd.Next(1, 10);
button4.Text = rndmoney1.ToString() + rndmoney2.ToString() + rndmoney3.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
}
private void timer2_Tick_1(object sender, EventArgs e)
{
if (c2 >= rndmoney2) timer2.Enabled = false;
{
}
if (b1 == 0)
{
//button1.BackColor = Color.Green;
//button2.BackColor = Color.Black;
//button3.BackColor = Color.Black;
}
else if (b1 == 1)
{
//button1.BackColor = Color.Black;
//button2.BackColor = Color.Yellow;
// button3.BackColor = Color.Black;
}
else if (b1 == 2)
{
//button1.BackColor = Color.Black;
// button2.BackColor = Color.Black;
// button3.BackColor = Color.Red;
}
c2 = c2 + 1;
b2 = c2 % 3;
button2.Text = c2.ToString();
}
private void timer3_Tick_1(object sender, EventArgs e)
{
if (c3 >= rndmoney3) timer3.Enabled = false;
{
}
if (b1 == 0)
{
//button1.BackColor = Color.Green;
//button2.BackColor = Color.Black;
//button3.BackColor = Color.Black;
}
else if (b1 == 1)
{
//button1.BackColor = Color.Black;
//button2.BackColor = Color.Yellow;
// button3.BackColor = Color.Black;
}
else if (b1 == 2)
{
//button1.BackColor = Color.Black;
// button2.BackColor = Color.Black;
// button3.BackColor = Color.Red;
}
c3 = c3 + 1;
b3 = c3 % 3;
button3.Text = c3.ToString();
}
}
}
沒有留言:
張貼留言