VB代码小问题

来源:百度知道 编辑:UC知道 时间:2024/05/27 04:31:50
我要切换图像,咋有问题呢?帮我看看代码:
Private Sub Command1_Click()
If Picture1.Visible = True Then
Picture1.Visible = True
Picture2.Visible = False
ElseIf Picture2.Visible = True Then
Picture1.Visible = False

End If

End Sub

Private Sub Command1_Click()
If Picture1.Visible = True Then
Picture1.Visible = False
Picture2.Visible = True
ElseIf Picture2.Visible = True Then
Picture2.Visible = Flase
picture1.Visible = True
End If
End Sub

这样写吧。你那个逻辑有点乱。
============
Private Sub Command1_Click()
Picture1.Visible = Not Picture1.Visible
Picture2.Visible = Not Picture1.Visible
End Sub

Private Sub Command1_Click()
If Picture1.Visible Then
Picture1.Visible = False
Picture2.Visible = True
Else
Picture1.Visible = True
Picture2.Visible = False
End If
End Sub