Displays horizontally scrolling text, vertically scrolling text, changing fonts for
each status bar pane, changing font colors for each status bar pane, changing background
colors for each status bar pane, displaying a bitmap banner across the status bar.
I was recently involved in a project that required colors along the status bar (basically, an owner-drawn status bar).
Although the requirement stopped at colors in certain panes, I went all out and created a class derived from
CStatusBar. My new class (CColorStatusBar) allows for different fonts in each pane, different text colors,
different background colors, horizontally scrolling text, vertically scrolling text, diagonally scrolling
text (I don’t know a use for diagonally scrolling text, but it’s fun to watch for a minute), and tiling a bitmap
across the status bar – excellent for identifying your software as BETA. I tried to create the new class to be
as close to a drop-in replacement for CStatusBar as possible, but in order to customize each pane, I had to
force a small amount of extra initialization in CMainFrame (or the owner of the status bar).
To exploit the capabilities of the status bar, double-click on a status bar pane to activate the Status
Bar Pane Properties. The dialog will allow you to toggle the status bar banner, transparent text,
horizontal and vertical scrolling, window pane font, font color, etc. The most remarkable code block is
contained in the header file ColorStatusBar.h and implementation file ColorStatusBar.cpp. Contained in
these files are the classes CStatusPaneInfo and CColorStatusBar. CStatusPaneInfo contains information
specific to a single status bar window pane. Items such as background color, foreground color, horizontal
and/or vertical scrolling, pane font, etc. CColorStatusBar keeps an accounting of the status bar window
pane information structures through the use of the CObList. Scrolling is accomplished through the use of a
timer and a CPoint which remembers the last upper-left position of the previous DrawText call.
Warning: There is a small amount of additional processing that needs to be accomplished during
creation of the status bar in MainFrm.cpp. Basically, the CStatusPaneInfo objects need to be created
for use by the OnPaint method in the status bar.