我该如何使用PictureBox图像条件 [英] How can I use PictureBox Image Condition

查看:54
本文介绍了我该如何使用PictureBox图像条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在做像Button一样的Picture Box,当我点击PictureBox3时我试图改变图像。通过使用IF条件,但它没有做。在这里我的代码:



Now am doing Picture Box like Button image, I trying to change image when i click on PictureBox3 . By Use IF Condition ,But it not doing. Here my code :

Dim phonestop As Image = My.Resources.phone_exit
   Dim phonestart As Image = My.Resources.phone_start

   Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
       If PictureBox3.Image Is phonestart Then
           PictureBox3.Image = phonestop
       Else
           PictureBox3.Image = phonestart
       End If
   End Sub

推荐答案

代码看起来正确 - 所以要做的第一件事就是遵循代码并查看实际发生的情况。

在事件处理程序的第一行放置一个断点,然后单步执行通过,随时查看变量。



很抱歉,但是有了这些小信息,那就是我现在能给出的最好的建议。请记住,我无法访问您的代码,因此无法在原地运行以检查...
The code looks right - so the first thing to do is to follow the code and see what is actually happening.
Put a breakpoint on the first line in the event handler, and single step through, looking at the variables as you go.

Sorry, but with that little info, that's about the best advice I can give at the moment. And remember, I don't have access to your code so I can't run it in situ to check...


这篇关于我该如何使用PictureBox图像条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆