求大神来看看这段代码哪里错了
private void timer4_Tick(object sender, EventArgs e)
{
int a = 0;
Random q = new Random();
a += (q.Next(1));
if (button1.Location.X==60||button4.Location.Y==80)
{
timer5.Enabled = true;
}
}
private void timer5_Tick(object sender, EventArgs e)
{
if (a == 0)
{
button1.visible = true
}
else
{
button1.Top += 20;
为什么每次这段代码都是执行else,怎么才能让他执行a=0时button1.visible=true C#求助
[解决办法]
public partial class Form1 : Form
{
public int a; //这个类下面的方法都可以使用
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
//可以使用a
}
private void timer2_Tick(object sender, EventArgs e)
{
//可以使用a
}
}