Hiding the Flat Toolbar Separators | CodeGuru

Hiding the Flat Toolbar Separators

I have been taking part in a project for the last two years. At first we were using Microsoft Visual C++ 5.0. I placed some controls into our toolbars using well-known method by using a toolbar separator. You could get more info about that at https://www.codeguru.com/toolbar/ctrls_in_tb.shtml. Changing Visual C++ version from 5.0 to 6.0 I […]

Written By
CodeGuru Staff
CodeGuru Staff
Feb 9, 2000
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

I have been taking part in a project for the last two years. At first we were using
Microsoft Visual C++ 5.0. I placed some controls into our toolbars using well-known
method by using a toolbar separator. You could get more info about that
at
https://www.codeguru.com/toolbar/ctrls_in_tb.shtml
. Changing Visual
C++ version from 5.0 to 6.0 I gave our toolbars the TBSTYLE_FLAT style.

After this I found that separators under some controls that have a small height
became visible. It was not so good. But I did not want to refuse from
the TBSTYLE_FLAT style. So I decided to fill rectangles of the separators intersecting
with controls using the toolbar background brush. I have created
CSeparatorsHidingToolBar class derived from MFC CToolBar class for
this purpose.

Step 1: Replace the instance of the CToolBar with
CSeparatorsHidingToolBar class or if you have your own toolbar
class simply derive it from CSeparatorsHidingToolBar one. Be
sure to add an include statement for CSeparatorsHidingToolBar
class definition.

That is all.

Downloads

Download demo project – 32 Kb
Download source – 1 Kb

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.