vb .net错误在运行时设置picturebox图像 [英] vb .net error set picturebox image at runtime
本文介绍了vb .net错误在运行时设置picturebox图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我有一个vb程序,一个带有图片框的表单,我想鼠标左键单击更改图像并设置另一个,我想使用if then语句所以ir将根据使用的图片改变图片。我的问题我得到一个错误operator''=''没有定义类型''system.drawing.image''......,如何更改代码才能工作?
Hello,
I have a vb program, a form with a picturebox, I want on mouse left click to change the image and set another one, I want to use an if then statement so ir will change picture according to the pic in use. My problem I get an error "operator ''='' is not defined for types ''system.drawing.image''...", how can I change the code to work?
If e.Button = Windows.Forms.MouseButtons.Left Then
If PictureBox1.Image = My.Resources._1 Then
PictureBox1.Image = My.Resources._2
End If
End If
推荐答案
您是否尝试过Image ObjecT中的equals方法?
Have you tried the equals method from Image ObjecT?
If PictureBox1.Image.Equals(My.Resources._1) Then
'Do your stuff
End If
希望这会有所帮助。
Hope this helps.
这篇关于vb .net错误在运行时设置picturebox图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文