Results 1 to 8 of 8

Thread: Greying out an Icon (bmp)

  1. #1
    Junior Member
    Join Date
    Sep 02
    Posts
    28

    Question Greying out an Icon (bmp)

    Hi all.

    I'm using BMP images stored in a ListView associated to a tree view for displaying icons on tree nodes. Now I am coding Cut/Copy/Paste operations and I'd like to grey out the icon of a Node that was "cut".

    Any suggestions?

    Thanks!
    Don't ask why, just reboot!

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 00
    Location
    Newcastle, England
    Posts
    4,349
    I did something similar to this a while back but I didn't really put much thought into it. What I did was just have a seperate icon for when its greyed out and greyed it out in my paint program before hand at design time. There may be a runtime solution but I think the simplest way is the better in this situation.

    That is unless I've missunderstood the question .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3
    Junior Member
    Join Date
    Sep 02
    Posts
    28

    Well...

    Thanks for answering, but I need such abitlity at runtime, since icons will change from one installation (client) to another.

    Thanks anyway!

    Alain
    Don't ask why, just reboot!

  4. #4
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 00
    Location
    Newcastle, England
    Posts
    4,349
    in that case how about writing a routine that creates the greyed out version when the new icons are added? This would n't be too hard I guess, depends exactly how you mean greyed out. First method I can think of is alphablending a plain grey color over it but depending on how you want it to look you would need to play with both the alpha value & the shade of grey (black, white or inbetween somewhere) .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  5. #5
    Junior Member
    Join Date
    Sep 02
    Posts
    28
    That's pretty much what I am looking for. I've tried different colors with different ways of overlapping images together, but it doesn't look good.
    Don't ask why, just reboot!

  6. #6
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 00
    Location
    Newcastle, England
    Posts
    4,349
    What kind of methods have you used? Have you tried a proper Alpha blending formula yet? I'll do a search cos I know its been posted a couple of times....
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  7. #7
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 00
    Location
    Newcastle, England
    Posts
    4,349
    Here is the alpha blending fuction that uses values between 0-255 for all its parts.
    FinalPixel is what it sounds like, AlphaValue is the blending ratio 0 means the result will be Destination & 255 would make the result Source. Source would be the color of the grey to be added. Destination would be the color of the pixel to be altered.
    Code:
    FinalPixel = (AlphaValue * (Source + 256 - Destination)) / 256 + Destination - AlphaValue
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  8. #8
    Junior Member
    Join Date
    Sep 02
    Posts
    28
    All right!

    Thanks, I'll try that. Now I have to put this part of the jop aside.

    Thanks a lot for the help!

    Hopefully I'll be able to do the same for you eventually...

    Ciao!

    Alain
    Don't ask why, just reboot!

Posting Permissions

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