Description
Sometimes, transparent static controls are very useful. For example, you have a dialog with a bitmap
in it and want to add some text in the picture. If you create a static control, your text will appear on an
opaque background, even if you've selected the WS_EX_TRANSPARENT
style (this style is *very*
buggy).
How to implement
To use the class in your application you need to do the following:
- Insert the .h and .cpp files into your project.
- Add a static control into your dialog resource.
- Add a member variable for that static control.
- Modify the variable declaration.
Change this:
CStatic m_Static
To this:
CTransparentStatic m_Static
- Don't forget the
#include
at the top of the include file:
#include "TransparentStatic.h"
That's it. You should now have a transparent background.
Features
The following Static Styles are implemented:
SS_LEFT
SS_LEFTNOWORDWRAP
SS_RIGHT
SS_CENTER
SS_CENTERIMAGE
(center text vertically)
SS_NOPREFIX
SS_WORDELLIPSIS
SS_ENDELLIPSIS
SS_PATHELLIPSIS
The various borders (SS_SUNKEN, WS_EX_CLIENTEDGE
, ...) are also supported.