Click here to Skip to main content
13,861,988 members
Click here to Skip to main content
Add your own
alternative version


91 bookmarked
Posted 27 Jan 2003
Licenced CPOL

Very simple true color toolbar (It's true!)

, 27 Jan 2003
Rate this:
Please Sign up or sign in to vote.
This is TrueColor Toolbar class

Sample Image - CTrueColorToolBar_Update.jpg


CTrueColorToolBar is a real true color toolbar. Implementation of the class is very very easy. The particularity of this toolbar is the auto detection of the mask color with the DIB section of the first pixel of bitmap toolbar.

Steps to use

  1. Create dummy 16 color toolbar in VC with the number of buttons and final size you need.
  2. In your favorite painter, make 3 other true color toolbar bitmaps for state buttons (Normal, Hot, Disabled) based on the first one.
  3. Import your new true color toolbars in VC.
  4. Create new CTrueColorToolBar toolbar with the sample implementation of normal toolbar.
  5. Call LoadTrueColorToolBar function with your 3 true color toolbar bitmaps and the size of a button.
  6. That's it!


//In Mainframe.h
#include "TrueColorToolBar.h"
class CMainFrame : public CFrameWnd
    CTrueColorToolBar m_ToolBarDrawLeft;

//In Mainframe.cpp
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

    if (!m_ToolBarDrawLeft.Create(this, WS_CHILD | 
        TRACE0("Failed to create toolbar\n");
        return -1; //Failed to create

    //Add bitmap to toolbar

    //Add DropDown Button
    m_ToolBarDrawLeft.AddDropDownButton(this, ID_BUTTON1, IDR_MENU1);

    return 0;


Note also that in the function LoadTrueColorToolBar, if you omit the last parameter for disabled toolbar, you will get a default embossed disabled toolbar. Enjoy!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Canada Canada

You may also be interested in...


Comments and Discussions

GeneralMy vote of 4 Pin
XiHong5-Nov-13 15:06
memberXiHong5-Nov-13 15:06 
Questionis it possible for CDialog? Pin
Lee Chi-Feng26-Aug-12 16:35
memberLee Chi-Feng26-Aug-12 16:35 
GeneralIs it possible to change a button's image at runtime Pin
miggedy7-Sep-10 6:24
membermiggedy7-Sep-10 6:24 
Questionhow can I change the background of buttons? Pin
wanglinhai88829-Dec-09 22:33
memberwanglinhai88829-Dec-09 22:33 
GeneralWhen using dialog it gives me a memory leak. Pin
mensfort2-Mar-09 3:35
membermensfort2-Mar-09 3:35 
GeneralWhen using dialog it gives me a memory leak. Pin
mensfort2-Mar-09 3:34
membermensfort2-Mar-09 3:34 
GeneralWhen using dialog it gives me a memory leak. Pin
mensfort2-Mar-09 3:33
membermensfort2-Mar-09 3:33 
GeneralGreat,, Just What I've Been Wanting Pin
MackemSteve6-Nov-08 2:26
memberMackemSteve6-Nov-08 2:26 
Questioncompiler error Pin
matangoldman23-May-08 7:02
membermatangoldman23-May-08 7:02 
AnswerRe: compiler error Pin
merano29-Mar-09 14:46
membermerano29-Mar-09 14:46 
QuestionNo TOOLTIPS? Pin
alex_tver4-Jan-08 14:25
memberalex_tver4-Jan-08 14:25 
QuestionGreat!!! How can I disable/enable buttons? Pin
Romiks7-Jun-07 5:45
memberRomiks7-Jun-07 5:45 
AnswerRe: Great!!! How can I disable/enable buttons? Pin
DCUtility7-Jun-07 15:47
professionalDCUtility7-Jun-07 15:47 
AnswerRe: Great!!! How can I disable/enable buttons? Pin
Paul Sanders (the other one)26-Oct-07 9:16
memberPaul Sanders (the other one)26-Oct-07 9:16 
GeneralThanks Pin
PJ Arends13-Sep-06 9:58
professionalPJ Arends13-Sep-06 9:58 
QuestionHow to replace the default toolbar? Pin
transoft3-Jun-06 5:24
membertransoft3-Jun-06 5:24 
QuestionLicense? Pin
juraitwaluzka30-May-06 18:35
memberjuraitwaluzka30-May-06 18:35 
Generalvs2005 compiler error Pin
banbanyy19-Jan-06 5:19
memberbanbanyy19-Jan-06 5:19 
AnswerRe: vs2005 compiler error Pin
akaworks1-Feb-06 11:59
memberakaworks1-Feb-06 11:59 
GeneralBMP at BackGround Pin
extus17-Sep-04 15:00
memberextus17-Sep-04 15:00 
QuestionHelp! Why these happened? Pin
youfly22-Jun-04 3:10
memberyoufly22-Jun-04 3:10 
AnswerRe: Help! Why these happened? Pin
abiendl2-Oct-04 1:35
memberabiendl2-Oct-04 1:35 
GeneralButton to big with drop-down Pin
quzi30-Apr-04 3:53
memberquzi30-Apr-04 3:53 
QuestionGood job,but how can i show text on the button? Pin
joxoy30-Apr-04 0:26
memberjoxoy30-Apr-04 0:26 
AnswerRe: Good job,but how can i show text on the button? Pin
quzi30-Apr-04 1:12
memberquzi30-Apr-04 1:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190214.1 | Last Updated 28 Jan 2003
Article Copyright 2003 by DCUtility
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid