Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
See more:

I can use the "WS_EX_TRANSPARENT" style to make a window transparent. That does work.

But when I try to paint on the transparent window, a problem occurs. While it's necessary to erase the background of the window to do a good job of painting, the erasure of the window's background turn out to be a problem since it will make the transparent window opaque again and the display will flicker.

I've tried to override the OnEraseBkgnd() function by just returning TRUE and use a null_brush to erase the background of the window myself (a dialog window in my case), but it didn't work. Therefore, I want to know how can I do a good job of painting while keeping the window on which the graphic is painted transparent all the time? I'm hoping that someone can help me! Thanks a lot!

Posted
Updated 22-Aug-21 5:20am
v2

Is it possible to use WS_EX_LAYERED style in this case? and set transparency using SetLayeredWindowAttributes(),[^].

Thanks
Radhakrishnan G.
 
Share this answer
 
v3
You should use SetWindowRgn, it makes literally any part of your window transparent, read more about it here: SetWindowRgn function (winuser.h) - Win32 apps | Microsoft Docs[^]. Also document your self about creating regions.
 
Share this answer
 
Comments
Richard MacCutchan 22-Aug-21 12:34pm    
This is yet another answer posted to a question that was raised more than eleven years ago. While your efforts are to be admired, it really is better to focus on current questions, where people are actually still waiting for solutions.
OriginalGriff 23-Aug-21 5:04am    
The problem is that you've already been picked up as "probable troll" because you are answering old questions.
Most of the time when people do that, it's to "hide" the answers away and rack up reputation points - and we count that as a form of site abuse and kick people from the site. And another member has started that process, for that reason.

I can stop it, but ... Richard and the other member do have a point - and your reply is aggressive in tone which doesn't help your case.
So, talk to me: why are you answering old questions exclusively? If you have a good reason, I'll do my best to stop you getting kicked off. If it's abuse, I'll help them along. But don't wait to long: we take a dim view of "rep point farming" and the kicking process can be remarkably quick!
CHill60 23-Aug-21 7:56am    
Possible hacked? Quiet for years then suddenly all this.
OriginalGriff 23-Aug-21 8:22am    
Either way, it'll close soon.
CHill60 23-Aug-21 10:00am    
"See stackoverflow, there the response to old unanswered question is welcomed" Er ... no it's not. They lock off questions to prevent such a thing

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