473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Is Picturebox a certain image

I am building an application to automate some testing. The status of
each of the tests is depicted by an image. This can either be an hour
glass, a cross or a tick and is initially set like so...

pictureBox1Status.Image =
global::TestApp.Properties.Resources.sandglass_48

If the test passes its image is changed to a tick using the same
method. All fairly simple.

When a timer expired I wanted to see which tests were still awaiting
results. The easiest way was to see if the image was still an hour
glass (instead of a separate status bool). I tried ...

if (pictureBox1Status.Image ==
global::TestApp.Properties.Resources.sandglass_48)
{
// change image to cross
}

Yep, the above test doesn't work. Its probably something simple and
silly but for the life of me I can't see what. I've tried all sorts,
like casting the image to a bitmap.

Could someone point out where my thinking is going wrong please.

Thanks in advance.

Andy

Oct 6 '08 #1
2 1071
On 06/10/2008 in message
<21**********************************@j22g2000hsf. googlegroups.comAndy
wrote:
>if (pictureBox1Status.Image ==
global::TestApp.Properties.Resources.sandglass_48 )
{
// change image to cross
}

Yep, the above test doesn't work. Its probably something simple and
silly but for the life of me I can't see what. I've tried all sorts,
like casting the image to a bitmap.

Could someone point out where my thinking is going wrong please.
The Image in the Picture Box is the image in the Picture Box, so can't be
tested for equality with one of your resources - unless you want to write
a function to compare it pixel by pixel :-)

Are you using the Tag on the Picture Box for anything? If not you could
set it to a number to represent the status.

--
Jeff Gaines Damerham Hampshire UK
If it's not broken, mess around with it until it is
Oct 6 '08 #2
On Oct 6, 4:50*pm, "Jeff Gaines" <whitedra...@newsgroups.nospam>
wrote:
>
The Image in the Picture Box is the image in the Picture Box, so can't be
tested for equality with one of your resources - unless you want to write
a function to compare it pixel by pixel :-)

Are you using the Tag on the Picture Box for anything? If not you could
set it to a number to represent the status.
Jeff,

Thanks for the quick reply.

I just had it in my head that being a local resource it would see if
it is the same object that was loaded, if you see what I mean.

I am actually using the tag in a similar manner as you suggested to
get over my problem. I just wanted to understand why the other
mechanism wasn't working as it seemed simpler.

Cheers

Andy
Oct 6 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Shailaja Kulkarni | last post by:
hi All, This problem is for C# windows application. I have a user control whcih contains one picture box along with other controls. Depending on certain conditions I want to change images on the...
4
by: Keith Smith | last post by:
I am making a program that needs to put a copy of a certain small image wherever the user clicks with the mouse. I am using a pictureBox as my main area (although I can change this if necessary). ...
2
by: David Ricker | last post by:
I have created a PictureBox control which can have it's Image property directly bound to an image field in a database. This works perfectly for showing the images that are in the database. When I...
0
by: akh | last post by:
I want to use de Drag and Drop ´s event to move a picture box from a form and within a Picture Box. But I have behaviour if the MyPBox As PictureBox as the Globale varible or not Thanks for...
2
by: Mark | last post by:
Hello, Say I write a picture file to: 'c:\test.jpg' Then I assign this picture to a picturebox PbFoto.Image = Image.Fromfile("c:\test.jpg") Next I want the overrwrite the file test.jpg with...
3
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
4
by: TomA | last post by:
Hi All, I have a picturebox on a form containing the photo of a person. As you advance through the records, the photo updates. Rather than storing the images in an inefficient blob field in a...
5
by: GoGs | last post by:
How this vb6 code convert in c# dotnet2 ----- Image1.Visible = False Image1.Picture = LoadPicture("c:\image008.jpg") Dim x, y As Single x = Image1.Width y = Image1.Height Do While x...
4
by: gerardianlewis | last post by:
Any help appreciated. (VB.NET under XP and Vista, SP1 installed) My code, inherited from a VB6 version of an app that ran under W98, loads an image from a file into a PictureBox. The user may...
5
by: AWW | last post by:
XP VB 2005 running an example from help that creates a picturebox in code - the picturebox is not created. If I comment out the "Dim Box as New PictureBox" and create it in Design mode - the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.