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