荫发出点击游戏的操作数,但有一个错误我不能正常工作。 错误是: 操作“ - ”不能应用于类型“字符串”和“廉政”
在私人无效timer1.tick的操作数。 我一直在寻找谷歌和本网站,但没有设法找到可比较的错误。我试过了较长的减号和短的减号。点击游戏 - 操作员“ - ”不能应用于类型“字符串”和“廉政”错误
(在Visual C#2010明示制造)
public partial class Form1 : Form
{
int timeLeft;
int counter = 10;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Interval = 1000;
timeLabel.Text = timeLabel.Text - 1;
{
if (timeLeft > 0)
{
timeLeft--;
timeLabel.Text = timeLeft + " seconds";
}
else
{
timer1.Stop();
timeLabel.Text = "Score";
MessageBox.Show(Score.Text, "Score");
Plus.Enabled = false;
}
}
}
private void Plus_Click(object sender, EventArgs e)
{
timer1.Start();
Score.Text = Score.Text + 1;
Score.Text = counter.ToString();
}
}