WTL Controls
|
Back to the WTL Controls Home Page. |
A very simple CStatic enhancement, providing custom text and background colors. More...
#include <StaticPlus.h>
Public Member Functions | |
CStaticPlus () noexcept | |
virtual | ~CStaticPlus () |
void | SubclassStatic (HWND hWnd) |
Subclass a Static TExt control window and create GDI resources. More... | |
void | UnSubclassStatic () |
Un-subclass the window and release GDI resources. More... | |
void | SetBtnFaceBkgnd (bool value) |
bool | GetBtnFaceBkgnd () const |
Default: false . More... | |
void | SetBackColor (COLORREF value) |
COLORREF | GetBackColor () const |
Default: COLOR_BTNFACE . More... | |
void | SetTextColor (COLORREF value) |
COLORREF | GetTextColor () const |
Default: COLOR_WINDOWTEXT . More... | |
void | UpdateContent () |
Wraps Invalidate and UpdateWindow, forcing an immediate redraw. More... | |
A very simple CStatic enhancement, providing custom text and background colors.
This class provides custom background and text colors by handling the reflected WM_CTLCOLORSTATIC. A bool
BtnFaceBkgnd will override the background color to force the background to the system-defined value, but it is false
by default.
This control isn't double-buffered, but an UpdateContent member function is included anyway; it calls Invalidate and UpdateWindow in sequence.
The member function SubclassStatic modifies the sub-classed window's style to include the SS_NOTIFY flag. The parent dialog must reflect WM_CTLCOLORSTATIC back to the control, with either the non-discriminating REFLECT_NOTIFICATIONS, or with something more selective (e.g, REFLECT_NOTIFICATIONS_MSG_FILTERED).
Sample usage is depicted below.
Definition at line 52 of file StaticPlus.h.
|
noexcept |
Definition at line 21 of file StaticPlus.cpp.
|
virtual |
Definition at line 33 of file StaticPlus.cpp.
void BIS_WTL_CONTROLS::CStaticPlus::SubclassStatic | ( | HWND | hWnd | ) |
Subclass a Static TExt control window and create GDI resources.
The SS_NOTIFY flag is added to the control's window styles, as well.
hWnd | The handle of the static text control window to be subclassed. |
void |
Definition at line 52 of file StaticPlus.cpp.
void BIS_WTL_CONTROLS::CStaticPlus::UnSubclassStatic | ( | ) |
Un-subclass the window and release GDI resources.
void |
Definition at line 69 of file StaticPlus.cpp.
void BIS_WTL_CONTROLS::CStaticPlus::SetBtnFaceBkgnd | ( | bool | value | ) |
Definition at line 123 of file StaticPlus.cpp.
bool BIS_WTL_CONTROLS::CStaticPlus::GetBtnFaceBkgnd | ( | ) | const |
Default: false
.
Definition at line 118 of file StaticPlus.cpp.
void BIS_WTL_CONTROLS::CStaticPlus::SetBackColor | ( | COLORREF | value | ) |
Definition at line 86 of file StaticPlus.cpp.
COLORREF BIS_WTL_CONTROLS::CStaticPlus::GetBackColor | ( | ) | const |
Default: COLOR_BTNFACE
.
Definition at line 81 of file StaticPlus.cpp.
void BIS_WTL_CONTROLS::CStaticPlus::SetTextColor | ( | COLORREF | value | ) |
Definition at line 107 of file StaticPlus.cpp.
COLORREF BIS_WTL_CONTROLS::CStaticPlus::GetTextColor | ( | ) | const |
Default: COLOR_WINDOWTEXT
.
Definition at line 102 of file StaticPlus.cpp.
void BIS_WTL_CONTROLS::CStaticPlus::UpdateContent | ( | ) |
Wraps Invalidate and UpdateWindow, forcing an immediate redraw.
Definition at line 138 of file StaticPlus.cpp.