Click here to Skip to main content
15,896,512 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I have a dialog with 2 static controls. In that one static text has transparent background and the other one doesn't on the same dialog.
No special property set for either of them.
why this behavior ?

And I wanted to know that can we achieve transparency for any static text control by any means other than overriding WM_CTLCLR (onctlclr() functionality) or WM_ERASEBKGND (onEraseBkgnd() functionality) , just by modifying rc file or by changing the property of the control or anything like that??

Thanks in advance :)

What I have tried:

1) analyzing Resource files and rc scripts did not help much.
2) It is going to work if we override WM_CTLCLR or EM_ERASEBKGND messages, but I want to know why its happening like that.
3) the following link gives a little insight of why transparency issue comes up with static text on dialog "https://blogs.msdn.microsoft.com/oldnewthing/20111028-00/?p=9243",
but it doesn't explain with multiple static text controls one being transparent and other's not.
Posted
Updated 27-Jun-16 0:21am
v2
Comments
Jochen Arndt 13-Jun-16 6:28am    
The provided link explains that static controls does not support transparent background and you must create a derived class to implement it overriding the relevant functions.

So it is rather unlikely that you have a transparent control. The default background colour for dialogs and static controls is the same. So the static control seems to be transparent if there are no other controls below it and the dialog's background colour has not been changed.
Prajyoth 13-Jun-16 22:49pm    
Thanks Jochen

1 solution

Check the properties in the resource editor - maybe they differ in some detail.

Other common reason:
* that they arent the same type or class
* the resource ID isnt the same as in the message handler

The article Transparent Static Text In Dialogs should give you some insights and example code for your problem.
 
Share this answer
 

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