怎么实现点击单机√和×实现相互交换?

这是一个TreeWidget弄出来的,√和× 是图片

第1个回答  2018-09-04
比较笨的方法,我想不出好办法来。放4个Picture控件,其中1个为Tmp并设置为不可见。代码如下Option ExplicitPrivate Sub Pct1_Click()
With Pct1
If Pct2.Tag = "1" Then
Tmp.Picture = .Picture
.Picture = Pct2.Picture
Pct2.Picture = Tmp.Picture
Pct2.Tag = "0"
ElseIf Pct3.Tag = "1" Then
Tmp.Picture = .Picture
.Picture = Pct3.Picture
Pct3.Picture = Tmp.Picture
Pct3.Tag = "0"
Else
.Tag = "1"
End If
End With
End SubPrivate Sub Pct2_Click()
With Pct2
If Pct1.Tag = "1" Then
Tmp.Picture = .Picture
.Picture = Pct1.Picture
Pct1.Picture = Tmp.Picture
Pct1.Tag = "0"
ElseIf Pct3.Tag = "1" Then
Tmp.Picture = .Picture
.Picture = Pct3.Picture
Pct3.Picture = Tmp.Picture
Pct3.Tag = "0"
Else
.Tag = "1"
End If
End With
End SubPrivate Sub Pct3_Click()
With Pct3
If Pct1.Tag = "1" Then
Tmp.Picture = .Picture
.Picture = Pct1.Picture
Pct1.Picture = Tmp.Picture
Pct1.Tag = "0"
ElseIf Pct2.Tag = "1" Then
Tmp.Picture = .Picture
.Picture = Pct2.Picture
Pct2.Picture = Tmp.Picture
Pct2.Tag = "0"
Else
.Tag = "1"
End If
End With
End Sub

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网