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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
int a = -50, b = -50, f, d;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
d = a % 150;
button1.Text = d.ToString();
if (a > 500)
{
f = 1;
}
if (a <= 50)
{
f = 2;
}
}
private void button2_Click(object sender, EventArgs e)
{
d = a % 150;
button2.Text = b.ToString();
if (a > 500)
{
f = 1;
}
if (a <= 50)
{
f = 2;
}
}
private void button3_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
d = a % 150;
button1.Text = d.ToString();
if (a > 500)
{
f = 1;
}
if (a <= 50)
{
f = 2;
}
if (f == 1)
if (d == 50)
{
button1.BackColor = System.Drawing.Color.Red;
}
if(d==100){
button1.BackColor = System.Drawing.Color.Black;
}
if (d == 0)
{
button1.BackColor = System.Drawing.Color.White;
}
if (d == 100)
{
button2.BackColor = System.Drawing.Color.Red;
}
if (d == 0)
{
button2.BackColor = System.Drawing.Color.Black;
}
if (d == 50)
{
button2.BackColor = System.Drawing.Color.White;
}
}
}
}
沒有留言:
張貼留言