【发布时间】:2016-08-28 01:14:21
【问题描述】:
我试图让 PictureBox 在按下时更改图像,如果再次按下它将更改为原始图像。我怎样才能做到这一点?这是我的代码。
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
If (PictureBox1.Image = WindowsApplication1.My.Resources.Resources.asd) Then
PictureBox1.Image = WindowsApplication1.My.Resources.Resources._stop()
Else
PictureBox1.Image = WindowsApplication1.My.Resources.Resources.asd()
End If
End Sub
当我运行它时,它给出了以下错误:
Operator '=' is not defined for types "Image" and "Bitmap".
【问题讨论】:
-
1) 我建议您使用
PictureBox1.Tag来存储它已设置为哪个图像的一些指示。 2) 我强烈建议您使用Option Strict On,以便在设计时向您显示此类问题,而不是仅在您运行程序时显示。 -
这不是我的问题...
标签: vb.net