【发布时间】:2015-07-30 05:20:56
【问题描述】:
我尝试了很多次,但都失败了。有 2 艘大游艇可供出租,但当用户选择第一艘大游艇时,按钮(图片)会变黑,并且会出现一个组合框,上面写着“Big Yacht 1 Booked”。但是,当我继续单击“bigyacht1”的 bigyacht 按钮时,“Big Yacht 1 Booked”文本不断发送垃圾邮件,我需要对 bigyacht2 执行相同操作。只需单击“返回”按钮即可返回(从组合框中删除)。请在这里需要一些帮助!!!!我的游艇租赁需要一个退货系统,但我不确定我的编码是否正确。[![下图是我为游艇租赁系统所做的编程。选择游艇时,图像会变黑,并且带有图像的按钮本身只能工作一次。我希望它也能与其他游艇按钮一样工作][1]][1] 请帮助
private void bigyacht1_Click(object sender, EventArgs e)
{
if (bigyacht1.CanSelect)
{
bigyacht1.BackgroundImage = Properties.Resources.big_yacht_BLACK;
bigyachtcomboBox.Items.Add(bigyachtcomboBox.Text = "Big Yacht 1 Booked");
}
else
{
bigyachtreturnButton.Select();
bigyachtcomboBox.Text = "";
bigyacht1.BackgroundImage = Properties.Resources.aluminum_mega_yacht_semi_displacement_hull_21287_6323513;
}
bigyacht1.BackgroundImage = Properties.Resources.aluminum_mega_yacht_semi_displacement_hull_21287_6323513;
}
private void bigyachtreturnButton_Click(object sender, EventArgs e)
{
bigyachtcomboBox.SelectedIndex = -1;
}
【问题讨论】:
-
为什么要在if-else-block之后再设置一次BackgroundImage?
-
请检查您的问题。 stackoverflow.com/help/how-to-ask