Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Changing Colors in a Bitmap

  1. #1

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    [RESOLVED] [2005] Changing Colors in a Bitmap

    Is there an easy way to manipulate a bitmap image to change every pixel from one color to another? I have star images in a datagridview column that I want to change background color when highlighted.

    Thanks!
    Last edited by neef; Dec 14th, 2007 at 10:59 PM.
    Intermediate Level Programmer Extraordinaire

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [2005] Changing Colors in a Bitmap

    you could write a small program that changes the colour of your star image using .setpixel

    use 2 loops

    vb Code:
    1. Dim img As New Bitmap(filename)
    2.  
    3.  
    4. for c = 0 to img.width
    5.     for r = 0 to img.height
    6.         if img.GetPixel(c, r) = ctype(color.fromargb(r,g,b), long) then
    7.            img.SetPixel(c, r, Color.Blue)    
    8.         end if
    9.     next
    10. next

    then you can change images, in your selected event

  3. #3

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    Re: [2005] Changing Colors in a Bitmap

    That's good stuff and should take care of things fine.

    Thanks so much!
    Intermediate Level Programmer Extraordinaire

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width