我正在尝试使某些标签按钮等在加载时可见,但是,当我单击该表单并返回到它时,form_load代码再次激活。它好像是一个onClick事件而不是加载。
我对编码完全陌生,所以这可能会非常简单
非常感谢
private void formCanvas_Load(object sender, EventArgs e)
{
lblUsed.Visible = false;
lblScore.Visible = false;
lblUsedLetters.Visible = false;
lblGuessWord.Visible = false;
lblUserChoice.Visible = false;
lblWord.Visible = true;
txtUserLetter.Visible = false;
txtUserWord.Visible = true;
btnSubmitWord.Visible = true;
btnSubmitLetter.Visible = false;
lblLives.Visible = false;
btnExit.Visible = false;
btnRestart.Visible = false;
}
答案 0 :(得分:0)
您应该将代码放在formCanvas类的构造函数
上public formCanvas()
{
InitializeComponent();
lblUsed.Visible = false;
lblScore.Visible = false;
lblUsedLetters.Visible = false;
lblGuessWord.Visible = false;
lblUserChoice.Visible = false;
lblWord.Visible = true;
txtUserLetter.Visible = false;
txtUserWord.Visible = true;
btnSubmitWord.Visible = true;
btnSubmitLetter.Visible = false;
lblLives.Visible = false;
btnExit.Visible = false;
btnRestart.Visible = false;
}