【发布时间】:2014-02-26 18:36:18
【问题描述】:
我正在尝试使用变量 iconName 从我的资源中选择和图像;但是我就是无法让它工作。
为了测试它是否出现,我将按钮文本更改为变量等于的值,这是正确的,但图像不会改变。
private void button_slctChamp_Click(object sender, EventArgs e)
{
// Set variable to equal string from a textbox + _Square_0
String iconName = textBox_slctChamp.Text + "_Square_0";
// Test to see if iconName = "string" + "_Square_0"
button_slctChamp.Text = iconName;
// Which it does
// Change Image of picturebox based on iconName
pictureBox_champIcon.Image = Properties.Resources.iconName;
// Never changes.........
【问题讨论】:
标签: c# winforms variables textbox picturebox