在C#中在textbox上输入一个数,点击按钮,根据数的范围,更换pictureBox里的图片
private void button1_Click(object sender, EventArgs e)
{
int ts = Convert.ToInt32(txttanshang.Text);
if (0<ts<120)
{
pictureBox1.BackgroundImage = WindowsFormsApplication2.Properties.Resources.BG1;
pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
}
else if (120 <= ts < 240)
{
pictureBox1.BackgroundImage = WindowsFormsApplication2.Properties.Resources.BG1;
pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
}
else if (240 <= ts < 360)
{
pictureBox1.BackgroundImage = WindowsFormsApplication2.Properties.Resources.BG1;
pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
}
else if (360 <= ts)
{
pictureBox1.BackgroundImage = WindowsFormsApplication2.Properties.Resources.BG1;
pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
}
}
如何处理 if (0<ts<120)处显示小于号无法处理bool和int类的操作