CColorStaticST is a class derived from MFC CStatic class.
This class lets put static controls inside your applications
and easly make them colored or even blinking!
CColorStaticST features:
Standard CStatic properties
Customizable background color
Customizable text color
Background color can blink
Text can blink
Notification message can be sent on rising blinks
Written in Visual C++ v5.0
Full source code included!
It's free!
You are encouraged to use this class everywhere you want; there is no fee
required for CColorStaticST. Freely add modifications and/or fix bugs, but please,
send any of these to SoftechSoftware!
How to integrate CColorStaticST in your application
In your project include the following files:
ColorStaticST.h
ColorStaticST.cpp
With dialog editor create a static text called, for example, IDC_DANGER
and create a member variable for it:
CColorStaticST m_stcDanger;
Now attach the static text to CColorStaticST. In your OnInitDialog procedure:
// Call the base method
CDialog::OnInitDialog();
// Create the IDC_DANGER text
m_stcDanger.SubclassDlgItem(IDC_DANGER, this);
By default the static text will have the standard system colors. Both
text and backgroud color can be customized:
// Change the text color to White
m_stcDanger.SetTextColor(RGB(255, 255, 255));
// Change the background color to Green
m_stcDanger.SetBkColor(RGB(0, 255, 0));
The text and/or the background can blink! Two colors must be
supplied for text and background blinks. First color will be
used for blink OFF state and second color for blink ON state (called also rising blink):
// Set blink colors for text
m_stcDanger.SetBlinkTextColors(RGB(128, 0, 0), RGB(255, 255, 255));
// Set blink colors for background
m_stcDanger.SetBlinkBkColors(RGB(128, 0, 0), RGB(255, 0, 0));
// Start text blinking
m_stcDanger.StartTextBlink(TRUE, CColorStaticST::ST_FLS_FAST);
// Start background blinking
m_stcDanger.StartBkBlink(TRUE, CColorStaticST::ST_FLS_FAST);
CColorStaticST can send a message to the parent window each time it has a
rising blink. To do this a user defined message and a parent window must be
supplied:
static const short GetVersionI()
static const char* GetVersionC()
Return CColorStaticST version
Example:
int nVer = CColorStaticST::GetVersionI(); // Divide by 10 to get actual version
char szVer[20];
strcpy(szVer, CColorStaticST::GetVersionC());
Add www.codeguru.com to your favorites Add www.codeguru.com to your browser search box IE 7 | Firefox 2.0 | Firefox 1.5.xReceive news via our XML/RSS feed
RATE THIS ARTICLE:
Excellent Very Good Average Below Average Poor
(You must be signed in to rank an article. Not a member? Click here to register)