Click here to Skip to main content
15,887,331 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone!

I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.

I have made a list view with transparent background using following API:
C#
SendMessage( GetDlgItem( hwnd, IDC_LIST1 ), LVM_SETBKCOLOR, (WPARAM)0,
                    (LPARAM)CLR_NONE );


Everything works fine, so I just wanted to make list view item's background transparent as well.

I have tried using the following API, hoping to achieve the same effect:

C#
SendMessage( GetDlgItem( hwnd, IDC_LIST1 ), LVM_SETTEXTBKCOLOR, (WPARAM)0,
                    (LPARAM)CLR_NONE );


Items background becomes black every time text is added to the item, but its subitems are transparent as they should be.

I have tried using custom draw, although I have never done custom draw before, specifying CLR_NONE, as text's background, but the effect is the same.

Everything works fine, if I specify some "normal" color as list view's background, yet if I try with CLR_NONE, I always get black background in list view's items( again, subitems are painted correctly ).

Please help, with some suggestions/ code examples/ links/ tutorials, I doubt I can solve this on my own.

That would be all, thanks again to everyone who will try to help.

I work in MS Visual Studio Express 2008, on Windows XP, in C++, using pure WIN32 API.

If any other information is required ( source code or something similar ), please ask for it, I will more than gladly supply it.
Posted
Updated 22-Jul-13 11:59am
v3

Uncle Google knows all

Did you see the CP article ?
 
Share this answer
 
Comments
MyOldAccount 22-Jul-13 8:33am    
You haven't read the whole article thoroughly, I will quote the author:

" When your application is closed, funny, it causes a crash here. I'll check it later :-) "
Argonia 22-Jul-13 8:39am    
Please add the message you are getting from the crash. I am guessing you are freeing something too early.
nv3 22-Jul-13 8:35am    
Correct! +5

In a nutshell: CLR_NONE is defined as 0xffffffff (or ~0) and this special value means "no background color" aka transparent. OP used color 0 instead, which simply means black (R, G and B components are 0) -- and that's what he got.
 
Share this answer
 
v2
Comments
MyOldAccount 20-Jul-13 17:59pm    
I am a beginner, and I don't know C#, so I must tell you that after trying to figure out a solution from those articles, I have failed, unfortunately.

If you can point me to some WIN32 samples/ tutorials, or try to give me detailed instructions I could try to solve my problem, thus being able to accept your solution.

Please help if you can.

Thanks anyway for trying, and posting your reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900