2014-12-27 58 views
0

我想使某些標籤按鈕等加載時可見,但是,當我點擊表單並返回到它form_load代碼再次激活。它就好像它是一個onClick事件而不是負載。問題與form_load

我完全新的編碼所以這可能是一些非常簡單

非常感謝

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

你應該把代碼的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; 

} 
+0

啊的構造好的,非常感謝,當我在表單上打開和關閉表單時,它是否有執行的原因? – Sifer

+0

@Sifer因爲根據你所指的是「打開和關閉」窗體,窗體可能是重新加載,這反過來導致OnLoad事件觸發。 –