Is Picturebox a certain image

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    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...

    pictureBox1Stat us.Image =
    global::TestApp .Properties.Res ources.sandglas s_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 (pictureBox1Sta tus.Image ==
    global::TestApp .Properties.Res ources.sandglas s_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

  • Jeff Gaines

    #2
    Re: Is Picturebox a certain image

    On 06/10/2008 in message
    <218bf883-1805-4da2-b358-381088712da8@j2 2g2000hsf.googl egroups.comAndy
    wrote:
    >if (pictureBox1Sta tus.Image ==
    >global::TestAp p.Properties.Re sources.sandgla ss_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

    Comment

    • Andy

      #3
      Re: Is Picturebox a certain image

      On Oct 6, 4:50 pm, "Jeff Gaines" <whitedra...@ne wsgroups.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

      Comment

      Working...