C#为图片框添加值

时间:2012-03-01 06:52:53

标签: c# if-statement picturebox

我刚刚发布了一些关于我正在使用Microsoft Visual C#express进行的C#游戏项目的事情。在试错之后,我在下面提供的代码将无效。有没有人有任何建议或帮助他们可以给我如何让它工作?带括号和星号和箭头的代码部分是错误,对我不起作用。 (注意:我正在Microsoft Visual C#express上制作一个表格。)

if (buttonFlag[0])
{
    return;
}

if (accept)
{
    return;
}


textBox2.Text = "";
textBox1.Text = "";
offerCounter++;

---> [[[ **pictureBox2.Image**]]]<--- = tempLabel = buttonList[0].ToString();
LostValues(tempLabel);
textBox1.Text = "-> you just opend " + tempLabel + "\n";

CallZero(tempLabel);

if (offerCounter == 20)
{
    finalValue = GetFinalValue();
    MessageBox.Show("You win " + finalValue.ToString());

    textBox1.Text = "Game is over" + "\n";
    textBox1.Text += "you won: " + finalValue.ToString();
    label16.Content = "you won:";
    label17.Content = finalValue.ToString();
    label18.Text = "Game Over";
    accept = true;
}

if (offerCounter <= 18)
{
    if ((offerCounter % 3) == 0)
    {
        GenerateNewOffer();
        textBox1.Text += "-> you have a new offer ";
        MessageBox.Show("you recieved a new offer !");
        textBox2.Text = newOffer.ToString();
    }
    else
    {
        offerRemainder = 3 - (offerCounter % 3);
        textBox1.Text += "-> Open " + offerRemainder.ToString() + "more box(es) for new offer";
    }
}
else
{
    textBox2.Text = "";
}

1 个答案:

答案 0 :(得分:2)

The PictureBox.Image属性需要Image个实例。读取两者的MSDN并相应地编码。