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 http://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


Comments

  • Layout and DefWindowProc problem...

    Posted by Legacy on 04/04/2003 12:00am

    Originally posted by: Chris

    I don't know what is Layout () doing, and where is defined
    m_bDelayedButtonLayout. And for what? MSDN docs don't say anything about Layout. In other words with this function I get critical error information and without everything works fine.

    I thought that DefWindowProc ( WM_PAINT... ) should do the same as CToolBar::OnPaint () but it don't. Without DefWindowProc I can't see any buttons ( separators too :) ).

    In regards...

    Reply
  • Very Nice Work

    Posted by Legacy on 02/06/2002 12:00am

    Originally posted by: Chris Richardson

    Thank you very much.

    Chris Richardson

    Reply
  • Hiding the Flat Toolbar Separators

    Posted by Legacy on 05/05/2001 12:00am

    Originally posted by: N Narayana Pai

    working fine. useful one

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds