有没有更短的实现?
源码:
bol.rar
(12.18 KB)
效果:
Dim op As Boolean
Dim of As Boolean
Dim flag(2) As Boolean
Private Sub Command1_Click(Index As Integer)
If Command1(Index).Caption = "开" Then
Command1(Index).Caption = "关"
flag(Index) = True
Else
Command1(Index).Caption = "开"
flag(Index) = False
End If
Dim f As Boolean
f = flag(1) And flag(2)
Image1.Picture = LoadPicture(IIf(f, "on.gif", "off.gif"))
End Sub
Private Sub Command2_Click()
If Command2.Caption = "开" Then
Command2.Caption = "关"
Image2.Picture = LoadPicture("on.gif")
Else
Command2.Caption = "开"
Image2.Picture = LoadPicture("off.gif")
End If
End Sub