Solved

Picturebox image comparison with resource image

Posted on 2008-10-29
1
1,102 Views
Last Modified: 2008-11-09
Hi,
I need to compare an embeded resource image, with the image in a picutre box, in order to determine what image is showing.
Something in the line of:

  if (picStatus.Image == TouchScreenLibrary.Properties.Resources.gears)
 {
        picStatus.Image = TouchScreenLibrary.Properties.Resources.gears_view;
 }

The above code does work however, how can I change it in order to do the comparison ?
0
Comment
Question by:wilcosw
1 Comment
 
LVL 8

Accepted Solution

by:
mac-will earned 250 total points
ID: 22858012
Not pretty, but this might work.
MemoryStream ms = new MemoryStream();
picStatus.Save(ms,System.Drawing.Imaging.ImageFormat.Jpeg);
 
MemoryStream ms2 = new MemoryStream();
gears.Save(ms2,System.Drawing.Imaging.ImageFormat.Jpeg);
 
if(ms.ToArray() == ms2.ToArray())

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question