This article presents a CStatic derived class that gently fades text into view.
To use the class simply declare a CStaticFader object, and then have that object
subclass a CStatic control on a dialog or form. The control can display a single line of
text, or two separate test strings on a single line (the "Main Text" and "SubText").

The CStaticFader class was designed to be used in a ticker app that I
was in the process of writing (at the time of this post). I pulled it out, neatened it up
and documented it purely for CodeProject enthusiasts.

Most of the functions are self-explanatory, with the exeption of Initialise and
Display. Initialise takes 3 parameters representing the colours of the control
background, the Main Text colour, and the SubText colour respectively.

The Display method accepts the Main Text, the Sub Text, the fade percent (the
fraction of a second it takes to fade the text), and a flag specifying whether or
not colours should be reset to default values. If the SubText string is not empty,
it is displayed in a separate field (as shown in the screenshot), otherwise the entire
control is used for the MainText.

The Display() function's last two parameters are designed for optional
use with Jamie's CAutoFont::ExtractFont() function. These have not been
tested ;)

To use the class, assume you have a CStaticFader object called
m_stcFader.
For this example we will set the background, Main Text, and SubText colours, set shadow
drawing as ON, center the text, then display some text and some SubText. We'll set the
nFadePercent value to 100 so that it takes a full second to fade the text into view:

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

When I add the CStaticFader class and hook them up to the member variable, then up closing the window down while I'm in debug mode I receive memory leaks. I ran your project in debug mode and it also has memory leaks.