CColorStaticST v1.1
Copyright (C) 1998-99 by SoftechSoftware
Thank you for use this SoftechSoftware! Thanks very much!
Contact
addresses
SoftechSoftware E-Mail:
davide_calabro@yahoo.com
SoftechSoftware homepage:
http://members.tripod.com/~SoftechSoftware/index.html
CColorStaticST homepage:
http://members.tripod.com/~SoftechSoftware/colorstc.html
Description
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:
Características de CColorStaticST
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!
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: // Enable notification message m_stcDanger.EnableNotify(this, WM_USER + 10); Your static text is now a CColorStaticST! Look inside the demo program to learn more about CColorStaticST. This is the best way! CColorStaticST members void SetTextColor(COLORREF crTextColor = 0xffffffff); Set color for text (when not blinking) Input values:
Example:
m_stcDanger.SetTextColor(RGB(255,
255, 255));
m_stcDanger.SetTextColor(); // To restore the default system
color
COLORREF
GetTextColor();
Get current text color
Example:
COLORREF
crRetValue = m_stcDanger.GetTextColor();
void
SetBkColor(COLORREF crBkColor = 0xffffffff);
Set color for background (when not blinking)
Input values:
Example:
m_stcDanger.SetBkColor(RGB(255,
0, 0));
m_stcDanger.SetBkColor(); // To restore the default system color
COLORREF
GetBkColor();
Get current background color
Example:
COLORREF
crRetValue = m_stcDanger.GetBkColor();
void
SetBlinkTextColors(COLORREF crBlinkTextColor1, COLORREF
crBlinkTextColor2);
Set colors for text (when blinking)
Input values:
Example:
m_stcDanger.SetBlinkTextColors(RGB(128,
0, 0), RGB(255, 255, 255));
void
StartTextBlink(BOOL bStart = TRUE, UINT nElapse = ST_FLS_NORMAL);
Start/stop text blinking
Input values:
Example:
m_stcDanger.StartTextBlink(TRUE,
CColorStaticST::ST_FLS_FAST);
m_stcDanger.StartTextBlink(TRUE, 250); // To blink with custom
intervall
m_stcDanger.StartTextBlink(); // To stop blinking
void
SetBlinkBkColors(COLORREF crBlinkBkColor1, COLORREF
crBlinkBkColor2);
Set colors for background (when blinking)
Input values:
Example:
m_stcDanger.SetBlinkBkColors(RGB(128,
0, 0), RGB(255, 0, 0));
void
StartBkBlink(BOOL bStart = TRUE, UINT nElapse = ST_FLS_NORMAL);
Start/stop background blinking
See StartTextBlink for possible input values
Example:
m_stcDanger.StartBkBlink(TRUE,
CColorStaticST::ST_FLS_FAST);
m_stcDanger.StartBkBlink(TRUE, 250); // To blink with custom
intervall
m_stcDanger.StartBkBlink(); // To stop blinking
void
EnableNotify(CWnd* pParent = NULL, UINT nMsg = WM_USER);
Enable/Disable sending notification message on rising blinks
Input values:
Example:
m_stcDanger.EnableNotify(this,
WM_USER + 10);
m_stcDanger.EnableNotify(); // To disable message sending
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());
History
Things to do
Copyright © 1998-99 by
SoftechSoftware.
davide_calabro@yahoo.com