Toolbar with 16M colour images

Download Source Code and Example  66KB

I tried Kevin Bentley's trick to use 256 colours but it didn't work.
I needed to have more than 256 colours - so I tried to find some alternative way - fortunately I found it.

Here's how can you use hi-color bitmaps on your toolbars:

At first, create your toolbar in Developer Studio - no matter what do you draw on buttons. Make a hi-color bitmap with a bitmap-editor (for example Paint Shop Pro). This new bitmap must be the same size as Toolbar.bmp in your project's \res folder. Then import the resource into your application as bitmap, name it IDB_TOOLBARHI. Here's what you must to do:

  • Make a CBitmap type global variable m_bmToolbarHi in your CMainFrame class
  • Include these lines in the function CMainFrame::OnCreate() after initializing the toolbar:
    if (!m_wndToolBar.Create(this) ||
        TRACE0("Failed to create toolbar\n");
        return -1; // fail to create

// ===========================================================
    m_bmToolbarHi.LoadBitmap( IDB_TOOLBARHI );
    m_wndToolBar.SetBitmap( (HBITMAP)m_bmToolbarHi );
// ===========================================================
  • Include this line in the destructor of CMainFrame:
// ===========================================================
// ===========================================================

That's all.

Last updated: 16 July 1998