|
Which is because the "Disable" bitmap is not set, and MFC uses the default algorithm to transform the "normal" bitmap, but this is very ugly for the true color toolbar.
So it is best to use code to set, use SetDisabledImageList () function, the picture can be obtained by the following simple methods:
Use PhotoShop to open the drawn menu bar menu image, select: Image->Mode->Grayscale, and then save it as a file for SetDisabledImageList!
Sample code:
CImageList img;
CBitmap bitmap;
The
// Set the minimum and maximum size of the button and support the extended button style
m_wndOftenToolBar.GetToolBarCtrl().SetButtonWidth(32, 42);
m_wndOftenToolBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
The
// Bitmap setting button "hot"
bitmap.LoadBitmap(IDB_HOTTOOLBAR);
img.Create(32, 31, ILC_COLOR8 | ILC_MASK, 0, 0);
img.Add(&bitmap, RGB(192,192,192));
m_wndOftenToolBar.GetToolBarCtrl().SetHotImageList(&img);
bitmap.Detach();
img.Detach();
The
// Bitmap setting button "cold"
bitmap.LoadBitmap(IDB_COLDTOOLBAR);
img.Create(32, 31, ILC_COLOR8 | ILC_MASK, 0, 0);
img.Add(&bitmap, RGB(192,192,192));
m_wndOftenToolBar.GetToolBarCtrl().SetImageList(&img);
bitmap.Detach();
img.Detach();
The
// Set the bitmap of the button "Disable"
bitmap.LoadBitmap(IDB_DISABLETOOLBAR);
img.Create(32, 31, ILC_COLOR8 | ILC_MASK, 0, 0);
img.Add(&bitmap, RGB(192,192,192));
m_wndOftenToolBar.GetToolBarCtrl().SetDisabledImageList(&img);
bitmap.Detach();
img.Detach(); |
|