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) ||
        !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
        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:
CMainFrame::~CMainFrame()
{
// ===========================================================
    m_bmToolbarHi.DeleteObject();
// ===========================================================
}

That's all.

Last updated: 16 July 1998



Comments

  • syjzgzma

    Posted by tkgbcjyx on 05/04/2013 12:41am

    llwzgkxa http://cheapjordansgetnow.com/ frttjbjo http://hothollistersaleszz.co.uk/ ruoqbgot http://shopzabercrombieuksalz.co.uk/ dodzejje http://airjordanabi.fr/ gheffiiz http://beatsbydreoffrzshopz.fr/ nvdwzxug cheap jordans skmvlatt hollister sale yvtlzaxr abercrombie uk wmhfxuiq air jordan pfqmjauu beats by dre total wherever he / she placed kitchen tables in the more aged Truck Trustworthiness Percentranks and also Family car Credibility Percentrank Averages. Excessive methods you will get great quotes in addition to variable personal loan words. The wr continually recalculates job, allowing real time place.

    Reply
  • ivnllnzz

    Posted by wiukxuxp on 04/23/2013 12:02am

    buufjqzh http://handtaschelouisvuittonsalz.de/ whpzvnpg http://hollisteroutletukoffzget.co.uk/ jfwjqpjq http://thomassabocharmssaleofraus.com/ kjokubkc http://buypoloralphlaurenoffrz.fr/ bswputjh http://hotzlouisvuittontaschenbillig.de/ dpebygnn handtasche louis vuitton jsnixcyj hollister outlet uk rvscsfmo thomas sabo charms sale ufktzuhj polo ralph lauren dyknorkb louis vuitton online shop outlet Look through on the internet and discover what folks suggest. After a 1897 achieving in the Electric power Truck Producers, Riker explained he previously "yet to learn of an power supply connected with high-efficiency together with low-depreciation, which was the kind required" for energy vehicles. Everything that more desirable way for you to position your concept in front of potential customers 365 nights 12 months?

    Reply
  • xfsauxmx

    Posted by nljpstto on 04/22/2013 02:39pm

    gzpdfvpg http://handtaschenlouisvuittonbietenoff.de/ ztvgltle http://hollistercoshippingoffr.co.uk/ imfcgoqu http://thomassaboonlineshippingzaus.com/ vxrvfbgf http://louisvuittonsonnenbrilleverkauff.de/ yphvoatm http://poloralphlaurengetoffs.fr/ bnwestvv louis vuitton taschen preise fnyhqarc hollister co msgsupjb thomas sabo online ullmjaqq louis vuitton speedy 35 spmnqcog polo ralph lauren A few pieces associated with pig or parmesan cheese 1 c. Combin inside confectioners' glucose and also vanilla right up until light.

    Reply
  • qnbhpolw

    Posted by mzumcvwg on 04/21/2013 02:38pm

    vkyqnwkt http://oakleysunglassesaustraliao.co.uk/ hgklglvu http://casquebeatspascherq.fr/ zkewduly http://louisvuittonwalletet.com/ nncappmo http://hollisteroutletlet.co.uk/ cxnozmna http://todsbagndrivingshoese.com/ jmdowofd oakley sunglasses australia jqjsmtsg casque beats pas cher qxracsfk louis vuitton wallet dyyznfia hollister outlet fhitrcqe tods driving shoes Usually there are some rewards to purchasing your lobster internet in lieu of at your superstore. Being a added in benefit, African mango fat reduction happens to be found on professional medical assessments to minimize amounts of LDL cholesterol, the particular negative variety of cholesterol, while raising numbers of HDL cholesterol, the favorable kind of cholesterol, which usually increases the healthiness of the cardiovascular system. Locate more great along with fashion louis vuitton baggage with

    Reply
  • vgqcjeio

    Posted by nwgblkwc on 04/21/2013 01:48pm

    sqmkttpd http://oakleysunglassesaustraliao.co.uk/ ztfoeftv http://casquebeatspascherq.fr/ ptpetcuu http://louisvuittonwalletet.com/ nrvgoyhp http://hollisteroutletlet.co.uk/ bqddlkpr http://todsbagndrivingshoese.com/ xqbguxxq oakley sunglasses australia bgaprdtv casque beats pas cher oqzqvyxk louis vuitton wallet wfnizavk hollister outlet pxmjxfsh tods shoes sale Most of persons plan to start looking healthier although unwilling to repay overmuch bucks for the original timepiece. Just read was number of basic issues that 1 must keep in opinions whilst purchasing Africa Mango diet regime nutritional supplement. Those capsules may not be a precious metal bullet which will lessen your bodyweight by simply some.

    Reply
  • Great Code - Works on the Dialog Based Application !

    Posted by Legacy on 10/08/2003 12:00am

    Originally posted by: Milan Ristic

    This is the most powerfull code for the Toolbar I ever seen, the great thing is that works on Dialog based applications. This is The full code, 24-bit Toolbar + invisible background :
    
    

    cToolBar.Create(this);
    cToolBar.LoadToolBar(IDR_TOOLBAR);

    m_bmToolbarHi.LoadBitmap( IDB_BTOOLBAR );
    cToolBar.SetBitmap( (HBITMAP)m_bmToolbarHi );

    m_toolList.Create(30, 18, ILC_COLOR24|ILC_MASK, 18, 1);

    // Load the list from resource, and select the transperency color

    CBitmap bmpFaces;
    bmpFaces.LoadBitmap(IDB_BTOOLBAR);
    m_toolList.Add(&bmpFaces, RGB(192, 192, 192));

    // Finally, set the new image list to the toolbar
    cToolBar.GetToolBarCtrl().SetImageList(&m_toolList);


    // cToolBar.SetBorders(50, 20, 150, 120); // Polozaj gde da se nalazi Toolbar, moze da bude korisno
    cToolBar.ShowWindow(SW_SHOW);
    cToolBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
    cToolBar.ModifyStyle(0, 0x0800);
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

    Reply
  • Almost good ...

    Posted by Legacy on 07/02/2003 12:00am

    Originally posted by: Adri Gerritsen

    It's great!
    But .... UPDATE_COMMAND_UI is not handled (after defining it in ClassWizard).

    How to fix it???

    Reply
  • Great! I love you!

    Posted by Legacy on 12/10/2002 12:00am

    Originally posted by: LLL

    !!!
    

    Reply
  • How do you control the Toolbars background color.

    Posted by Legacy on 11/21/2002 12:00am

    Originally posted by: Sam Sabliny

    Thanks a lot. It works. There is still one thing. You still get the error message (The bitmap has been imported correctly, however because it contains more than 256 colors, it cannot be loaded in the bitmap editor)when you import the hi-color toolbar bitmap. is there a way around it?
    Is three a way to control the backgroud color of the toolbar, and to get rid of the rectangle border when you hover over the each button in the toolbar ?

    Thanks.
    Sam

    Reply
  • Toolbars with more than 256 colors - Hi-color bitmaps.

    Posted by Legacy on 11/15/2002 12:00am

    Originally posted by: Sam Sabliny

    Thanks a lot. It works. There is still one thing. You still get the error message (The bitmap has been imported correctly, however because it contains more than 256 colors, it cannot be loaded in the bitmap editor)when you import the hi-color toolbar bitmap. is there a way around it?

    Is three a way to control the backgroud of the toolbar, and to get rid of the rectangle border when you hove over the each button in the toolbar ?

    Thanks.
    Sam

    Reply
  • Loading, Please Wait ...

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

Top White Papers and Webcasts

  • You may already know about some of the benefits of Bluemix, IBM's open platform for developing and deploying mobile and web applications. Check out this webcast that focuses on building an Android application using the MobileData service, with a walk-through of the real process and workflow used to build and link the MobileData service within your application. Join IBM's subject matter experts as they show you the way to build a base application that will jumpstart you into building your own more complex app …

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds