Click here to Skip to main content
12,890,388 members (55,670 online)
Click here to Skip to main content
Add your own
alternative version


65 bookmarked
Posted 25 Apr 2002

Bitmap ToolBar

, 25 Apr 2002
Rate this:
Please Sign up or sign in to vote.
This is my attempt to create a simple toolbar class that allows to set a bitmap in the backgroud of a toolbar
<!-- Download Links --> <!-- Article image -->

Sample Image - screen.jpg

<!-- Add the rest of your HTML here -->


This is my attempt to create a simple toolbar class that allows to set a bitmap in the background of a toolbar. It is not as successful as the BCGControl lib but that's a beginning...

Some improvements could be made; for example, a hot image is not used. The process also flickers a little when clicking a button. The class should also be modified to Load the background only once to update only the buttons rect.

To use

  • Create the toolbar as usual:
    if (!myToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    	TRACE0("Failed to create toolbar\n");
    	return -1;      // fail to create

    DB_BITMAP_TAHITI = id of the background bitmap.
    IDB_BITMAP_TOOLBAR = id of the toolbar bitmap.
    9 is the number of buttons of the bitmap.
    false is a boolean that define if the background bitmap must be stretched if its size is different of the toolbar.

    Note that TBSTYLE_FLAT will create flat format buttons... else, standard 3D buttons will be added.

  • Set the style of the process, IM_STRECH or IM_TRANSPARENT.
    will take the toolbar image as it is and remove the background color.
    stretch the bitmap to the size of the button.
    m_wndToolBar.ImageStyle = IM_TRANSPARENT;
    m_wndToolBar.MaskColor = RGB(198, 195, 198);
  • Define if the bitmap must be applied on the complete control frame or only on the toolbar.
    m_wndToolBar.all_frame = true

  • You can modify the type of button with the DrawEdge function's options.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Nicolas Gazelle
Web Developer
Monaco Monaco
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionProblem with docking at CBRS_LEFT or CBRS_RIGHT. Pin
hunzaixa16-Apr-08 23:10
memberhunzaixa16-Apr-08 23:10 
QuestionCan anyone explain me a bit about the source code? Pin
Bomberofdoom4-May-07 6:29
memberBomberofdoom4-May-07 6:29 
Hi, I'm a basic C, C++ programmer and I'm trying to do a toolbar project on my own by looking at others porjects and I'm having a some trouble understanding this toolbar's source code.
Is there any chance someone could explain it to me in an email or through MSN?
My MSN is
GeneralProblem with Docking Pin
dnataraja28-Mar-06 1:54
memberdnataraja28-Mar-06 1:54 
Generalthank you Nicolas Pin
quike604128-Dec-05 11:45
memberquike604128-Dec-05 11:45 
GeneralToolbar with gif Pin
quike60412-Oct-05 5:06
memberquike60412-Oct-05 5:06 
QuestionHow to display .gif file on the toolbar and react to user click Pin
quike604130-Aug-05 13:11
memberquike604130-Aug-05 13:11 
AnswerRe: How to display .gif file on the toolbar and react to user click Pin
Nicolas Gazelle30-Aug-05 21:53
sussNicolas Gazelle30-Aug-05 21:53 
GeneralIs it possible on C# Pin
Inquire2you3-Sep-04 14:11
memberInquire2you3-Sep-04 14:11 
GeneralRe: Is it possible on C# Pin
chengser14-Aug-05 19:16
memberchengser14-Aug-05 19:16 
AnswerRe: Is it possible on C# Pin
The Dogcow Farmer9-Jul-08 6:30
memberThe Dogcow Farmer9-Jul-08 6:30 
Questiondont work well why?? Pin
jason_pei23-Jun-04 16:01
memberjason_pei23-Jun-04 16:01 
QuestionHow to display .gif file on the toolbar and react to user click Pin
Sam Morgan3-May-04 8:50
sussSam Morgan3-May-04 8:50 
GeneralNot so Bad Pin
Anonymous19-Nov-02 7:15
sussAnonymous19-Nov-02 7:15 
GeneralToobarControls Pin
AnthonyWinters30-Oct-02 9:28
memberAnthonyWinters30-Oct-02 9:28 
GeneralRe: ToobarControls Pin
Beer7-Dec-02 7:27
memberBeer7-Dec-02 7:27 
GeneralRe: ToobarControls Pin
Sir.Costy5-Dec-06 22:30
memberSir.Costy5-Dec-06 22:30 
GeneralBitmap Toolbar Pin
premdutt15-Aug-02 20:29
susspremdutt15-Aug-02 20:29 

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 | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 26 Apr 2002
Article Copyright 2002 by Nicolas Gazelle
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid