PC Review


Reply
Thread Tools Rate Thread

How to Compare Picture box's BackgroundImage Property

 
 
Dino M. Buljubasic
Guest
Posts: n/a
 
      3rd Sep 2003

I would like to be able to compare BackgroundImage Property of two picture
boxes on my form.

How can I do that?

I am using :

if (pctOne.BackgroundImage Is pctTwo.BackgroundImage) then
// blah, blah, blah
end if

, but this does not work.

Any help will be appreciated.


--
Dino Buljubasic
Software Developer
http://rivusglobal.com


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Sep 2003
Hello,

"Dino M. Buljubasic" <(E-Mail Removed)> schrieb:
> I would like to be able to compare BackgroundImage Property of
> two picture boxes on my form.
>
> How can I do that?
>
> I am using :
>
> if (pctOne.BackgroundImage Is pctTwo.BackgroundImage) then
> // blah, blah, blah
> end if
>
> , but this does not work.


The code above will compace the references represented by the
'BackgroundImage' properties. Do you want to compare the _images_
("bitmaps") or the _references_?

Comparing the images is really slow in VB.NET. It's better to use something
like this C# routine using pointers (*grml*):

http://www.palmbytes.de/content/dotn...magecompare.cs

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Dino M. Buljubasic
Guest
Posts: n/a
 
      3rd Sep 2003
Thanks Herfried,

I'd like to compare the bitmaps (or jpg). Is there a way to do that in
VB.net?

Regards,

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

"Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello,
>
> "Dino M. Buljubasic" <(E-Mail Removed)> schrieb:
> > I would like to be able to compare BackgroundImage Property of
> > two picture boxes on my form.
> >
> > How can I do that?
> >
> > I am using :
> >
> > if (pctOne.BackgroundImage Is pctTwo.BackgroundImage) then
> > // blah, blah, blah
> > end if
> >
> > , but this does not work.

>
> The code above will compace the references represented by the
> 'BackgroundImage' properties. Do you want to compare the _images_
> ("bitmaps") or the _references_?
>
> Comparing the images is really slow in VB.NET. It's better to use

something
> like this C# routine using pointers (*grml*):
>
> http://www.palmbytes.de/content/dotn...magecompare.cs
>
> Regards,
> Herfried K. Wagner
> --
> MVP · VB Classic, VB.NET
> http://www.mvps.org/dotnet
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Sep 2003
Hello,

"Dino M. Buljubasic" <(E-Mail Removed)> schrieb:
> I'd like to compare the bitmaps (or jpg). Is there a way to do that in
> VB.net?


Really slow: Loop through the 'Bitmap' object's pixels and compare the
colors at (x, y). You can get the color of the pixel at position (x, y) by
calling the 'Bitmap' objects's 'GetPixel' method.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      3rd Sep 2003
Hi again,

Another way - a bit of a cheat - save both to disk and then do a file
compare. :-)

Regards,
Fergus


 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Sep 2003
:-)))


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Sep 2003
Hello,

"Fergus Cooney" <filter-(E-Mail Removed)> schrieb:
[Algorithm for comparing bitmaps]

> Hope this informs, if nothing else.


Are you sure that this is faster than comparing each pixel?

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Sep 2003
Hello,

"Fergus Cooney" <filter-(E-Mail Removed)> schrieb:
> Another way - a bit of a cheat - save both to disk and then do a file
> compare. :-)


Maybe it's even possible to save the bitmaps to 'FileStream's.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Sep 2003
Hello,

"Cor" <(E-Mail Removed)> schrieb:
> :-)))


It would be great if you quote the paragraph you are referring to so others
can understand what you mean.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Sep 2003
Herfried,
I will keep it im mind something more, I dont like the way from long
messages where somewhere is some text but I will try to do it on a better
way.
For this one it was not by accident, it was very special. I don't want a
discussion with others.
grrrrrrrrrrrrrr :-) Is that enough in this situation?
Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How check BackgroundImage property? VB Programmer Microsoft VB .NET 1 2nd Nov 2005 12:55 AM
when i set the BackgroundImage property in the designer the image still doesnt show in the background of the textbox any other property must be set? Daniel Microsoft C# .NET 1 2nd Nov 2004 02:43 PM
when i set the BackgroundImage property in the designer the image still doesnt show in the background of the textbox any other property must be set? Daniel Microsoft Dot NET 0 2nd Nov 2004 02:03 AM
Textbox BackgroundImage property John Microsoft VB .NET 1 15th Sep 2004 10:06 PM
BackgroundImage Property in RichTextBox PB Kishore Microsoft Dot NET Framework Forms 2 3rd Sep 2003 05:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:38 PM.