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!
Printable View
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!
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 :D.
Thanks for answering, but I need such abitlity at runtime, since icons will change from one installation (client) to another.
Thanks anyway!
Alain
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) ;).
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.
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....
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
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