vc的工具条只支持16色,神仙也帮不了你

解决方案 »

  1.   

    goodboyws(深夜不眠者):不知道就不要乱说 :(
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;//Other Code
    //.....if (!m_wndToolBar.CreateEx(this) 
    || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
    TRACE0("Failed to create Toolbar\n");
    return -1; // fail to create
    }
    {
    CImageList imageList;
    CBitmap bitmap;// Create and set the normal toolbar image list.
    //IDB_BITMAP_COLD 是一套工具栏的图,高31
    bitmap.LoadBitmap(IDB_BITMAP_COLD);
    imageList.Create(32, 31, ILC_COLORDDB|ILC_MASK, 11, 1);
    //RGB(161,161,161)是透明色
    imageList.Add(&bitmap, RGB(161,161,161));
    m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, 
    (LPARAM)imageList.m_hImageList);
    imageList.Detach();
    bitmap.Detach();

    // Create and set the hot toolbar image list.
    bitmap.LoadBitmap(IDB_BITMAP_TOOL);
    imageList.Create(32,31, ILC_COLORDDB|ILC_MASK, 11, 1);
    imageList.Add(&bitmap, RGB(254,254,254));
    m_wndToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
    imageList.Detach();
    bitmap.Detach();
    }
    .....
    }