0
我目前正在製作一個程序,並且正在添加一個實用程序窗體,並且我有按鈕和麪板。 1個面板的按鈕,所以我有代碼,如果他們點擊一個按鈕,而另一個面板是可見的隱藏和顯示其他面板。出於某種原因,我必須點擊按鈕兩次才能切換到不同的面板,不知道爲什麼。單擊一個按鈕更改面板
代碼:
Private Sub btnAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbout.Click
If pnlAbout.Visible = False Then
pnlAbout.Visible = True
Else
If pnlProfile.Visible = True Then
pnlProfile.Visible = False
pnlAbout.Visible = True
If pnlUpdates.Visible = True Then
pnlUpdates.Visible = False
pnlAbout.Visible = True
End If
End If
End If
End Sub
Private Sub btnProfile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProfile.Click
If pnlProfile.Visible = False Then
pnlProfile.Visible = True
Else
If pnlAbout.Visible = True Then
pnlAbout.Visible = False
pnlProfile.Visible = True
If pnlUpdates.Visible = True Then
pnlUpdates.Visible = False
pnlProfile.Visible = True
End If
End If
End If
End Sub
Private Sub btnUpdates_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdates.Click
If pnlUpdates.Visible = False Then
pnlUpdates.Visible = True
Else
If pnlAbout.Visible = True Then
pnlAbout.Visible = False
pnlUpdates.Visible = True
If pnlProfile.Visible = True Then
pnlProfile.Visible = False
pnlUpdates.Visible = True
End If
End If
End If
End Sub
謝謝,這完美地工作。 – Rogueleet 2015-03-31 21:21:51