Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 31st, 2005, 07:08 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default WHY DOESNT THIS WORK

Dim pixelColor As Color
        Dim x As Integer
        Dim y As Integer

        Do
            pixelColor = myBitmap.GetPixel(x, y)
            Label1.BackColor = pixelColor
            If pixelColor = Color.Red Then
                MsgBox("YOU FOUND COLOR AT " & x & " " & y & "!")
                Exit Do
            End If
            x += 1
            If x = myBitmap.Width Then
                x = 0
                y += 1
            End If
        Loop Until y = myBitmap.Height
the loop works very well except the code has a problem with the
If pixelColor = Color.Red Then
                MsgBox("YOU FOUND COLOR AT " & x & " " & y & "!")
                Exit Do
            End If
it has trouble with the first line. I cant remember what i can use to check wheter a color matches a color. EX
IF color1 = color2 then
dosomthing
end if
Any help is wonderful help

~~~~~~~~~~~~~~~~~~~~~
I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter.
__________________
~~~~~~~~~~~~~~~~~~~~~
I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter.
  #2 (permalink)  
Old August 1st, 2005, 12:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

If pixelColor.Equals(Color.Red) Then
    MsgBox("YOU FOUND COLOR AT " & x & " " & y & "!")
    Exit Do
End If
  #3 (permalink)  
Old August 1st, 2005, 01:21 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok i tried that like this
Dim pic as new bitmap("C:\test.bmp")
'test.bmp is a 50x50 full black picture
DIm pixelcolor as color
pixelcolor = pic.getpixel(10,10)
'should be black
If pixelcolor.equals(color.black) then
  messagebox.show("YAY")
End If


~~~~~~~~~~~~~~~~~~~~~
I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter.
  #4 (permalink)  
Old August 1st, 2005, 04:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You are probably better off to use the RGB value than a named color. Try this, it worked for me:

If pixelcolor.Equals(Color.FromArgb(0, 0, 0)) Then
  MessageBox.Show("YAY")
End If
  #5 (permalink)  
Old August 1st, 2005, 04:53 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

TY TY TY this forum is the best place on the net for code q's!!! IT WOOORRRRKKSS thanks again.

Wrox Rocks (say that 10x fast)


~~~~~~~~~~~~~~~~~~~~~
I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter.
  #6 (permalink)  
Old August 1st, 2005, 11:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Your welcome. Glad I could help.

J


Similar Threads
Thread Thread Starter Forum Replies Last Post
Membership and Roles doesnt work Baby_programmer ASP.NET 2.0 Professional 2 July 29th, 2008 09:41 AM
c:out doesnt work tllcll JSP Basics 1 November 1st, 2007 03:15 AM
xsl:key doesnt work cristtiah XSLT 11 May 24th, 2006 09:57 AM
Button doesnt work help john111 Java GUI 4 March 21st, 2006 05:22 PM
ContainsValue doesnt work demitry Generics 1 November 21st, 2005 05:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.