Enhanced statusbar class | CodeGuru

Enhanced statusbar class

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 6, 1998
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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.

Download project files 35KB

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.