C# 如何在windows窗体中更改窗体图标
请我需要帮助我正在为hangman游戏编写代码,我只想更改表单的图标,我尝试使用图标属性,但它不再工作,请告诉我如何做到这一点,我还执行以下项目-->属性-->图标和清单,但它也不工作这是我的游戏代码,它工作得很好:C# 如何在windows窗体中更改窗体图标,c#,visual-studio-2010,windows-forms-designer,C#,Visual Studio 2010,Windows Forms Designer,请我需要帮助我正在为hangman游戏编写代码,我只想更改表单的图标,我尝试使用图标属性,但它不再工作,请告诉我如何做到这一点,我还执行以下项目-->属性-->图标和清单,但它也不工作这是我的游戏代码,它工作得很好: private void button1_Click(object sender, EventArgs e) { stage_count++;//strat from stage 1
private void button1_Click(object sender, EventArgs e)
{
stage_count++;//strat from stage 1
if (!int.TryParse(textBox1.Text.ToString(), out value))
return;//if user inter non_integer value do no thing and wait for new entry
if (key ==value )//directly if user guesses the key he/she wins the game
{
//view the seventh picture in hangman game
button1.Enabled = false;
textBox1.Text = "";
textBox1.Enabled = false;
pictureBox7.Visible = true;
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
groupBox1.Visible = true;
label1.Text = "Great... You Got It ^_^ ";
}
if (key > value)//guide the user to the correct answer
label1.Text = "Should Be Greater than" + value.ToString();
if (key < value)//guide the user to the correct answer
label1.Text = "Should Be Less than" + value.ToString();
if (key != value)
{
switch (stage_count)
{//this switch statement used to do some thing in each stage
case 1:
//view the first picture in hangman game
pictureBox1.Visible = true;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
break;
case 2:
//view the second picture in hangman game
pictureBox1.Visible = false;
pictureBox2.Visible = true;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
break;
case 3:
//view the third picture in hangman game
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = true;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
break;
case 4:
//view the fourth picture in hangman game
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = true;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
break;
case 5:
//view the fifth picture in hangman game
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = true;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
break;
default:
//view the sixth picture in hangman game
//it's the last try so diable the button and show the result
button1.Enabled = false;
textBox1.Text = "";
textBox1.Enabled = false;
groupBox1.Visible = true;
label1.Text = "YOU LOSE ,, IT WAS : " + key.ToString();
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = true;
pictureBox7.Visible = false;
break;
}//end switch
//to make empty focused textbox
textBox1.Text = "";
textBox1.Focus();
}//end if
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{// if user want to playe new game the programm must enables the important controls and
//make the visible property equals to false for all the pictures boxes
if (radioButton1.Checked == true)
{
stage_count = 0;
key = (1 + obj.Next(99));
textBox1.Enabled = true;
textBox1.Text = "";
textBox1.Focus();
button1.Enabled = true;
label1.Text = "Guess a number btween 1-100";
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
groupBox1.Visible = false;
radioButton1.Checked = false;
}
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
// if user won't to play again just close it
if (radioButton2.Checked == true)
{
radioButton2.Checked = false;
this.Close();
}
}
}
}
private void按钮1\u单击(对象发送者,事件参数e)
{
阶段_count++;//从阶段1开始
如果(!int.TryParse(textBox1.Text.ToString(),out值))
return;//如果用户inter非_整数值不做任何事情并等待新条目
if(key==value)//如果用户猜到了他/她赢得游戏的密钥,则直接
{
//查看刽子手游戏中的第七张图片
按钮1.启用=错误;
textBox1.Text=“”;
textBox1.Enabled=false;
pictureBox7.Visible=true;
pictureBox1.Visible=false;
pictureBox2.可见=假;
pictureBox3.Visible=false;
pictureBox4.Visible=false;
pictureBox5.Visible=false;
pictureBox6.Visible=false;
groupBox1.Visible=true;
label1.Text=“太好了……你明白了^ ^”;
}
if(key>value)//引导用户找到正确答案
label1.Text=“应大于”+value.ToString();
if(key