VB picturebox的一点问题
现在我定义了三个picturebox,假设图片p为picturebox1当前内容,然后三个picturebox的图片进行互换,最后我如何判断picturebox1.image 是否与 p相等,要用什么语句?我用 if picturebox1.image is p then
不可以实现,达不到效果
求解啊求解 --------------------编程问答-------------------- Option Explicit
Dim p As StdPicture
Private Sub Command1_Click()
Randomize
Dim x As Long
Dim p As StdPicture
x = Rnd * 3
Select Case x
Case 0
Set p = Pic1.Picture
Set Pic1.Picture = Pic2.Picture
Set Pic2.Picture = p
Case 1
Set p = Pic2.Picture
Set Pic2.Picture = Pic3.Picture
Set Pic3.Picture = p
Case 2
Set p = Pic1.Picture
Set Pic1.Picture = Pic3.Picture
Set Pic3.Picture = p
End Select
End Sub
Private Sub Command2_Click()
MsgBox "Pic1 Is P: " & CStr(Pic1.Picture Is p) & vbCrLf & "Pic2 Is P: " & CStr(Pic2.Picture Is p) & vbCrLf & "Pic3 Is P: " & CStr(Pic3.Picture Is p) & vbCrLf
End Sub
Private Sub Form_Load()
Set p = Pic1.Picture
End Sub
--------------------编程问答-------------------- 作个弊,
在互换的时候用picturebox1.Tag纪录一下吧:
Set picturebox1.Picture = pictureboxX.Picture
picturebox1.Tag = X
只要取picturebox1.Tag值不就知道了? --------------------编程问答-------------------- PS:
Set picturebox1.Picture = picturebox2.Picture
picturebox1.Tag = 2
补充:VB , 控件