Hi-color toolbars
-
void SetTbImageList(CToolBar &tb, UINT nMessage, UINT nIDBitmap)
{
CImageList imageList;
CBitmap bitmap;bitmap.LoadBitmap(nIDBitmap); BITMAP bm; bitmap.GetBitmap(&bm); imageList.Create(bm.bmHeight, bm.bmHeight, ILC\_COLORDDB|ILC\_MASK, 0, 1); imageList.Add(&bitmap, RGB(255,0,255)); tb.SendMessage(nMessage, 0, (LPARAM)imageList.m\_hImageList); imageList.Detach(); bitmap.Detach();
}
// if you want to have 'hot' and 'cold' images
SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapColdID);
SetTbImageList(m_toolbar, TB_SETHOTIMAGELIST, nBitmapHotID);// if you don't want to use 'hot' images
SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapID);Tomasz Sowinski -- http://www.shooltz.com
- It's for protection
- Protection from what? Zee Germans? -
void SetTbImageList(CToolBar &tb, UINT nMessage, UINT nIDBitmap)
{
CImageList imageList;
CBitmap bitmap;bitmap.LoadBitmap(nIDBitmap); BITMAP bm; bitmap.GetBitmap(&bm); imageList.Create(bm.bmHeight, bm.bmHeight, ILC\_COLORDDB|ILC\_MASK, 0, 1); imageList.Add(&bitmap, RGB(255,0,255)); tb.SendMessage(nMessage, 0, (LPARAM)imageList.m\_hImageList); imageList.Detach(); bitmap.Detach();
}
// if you want to have 'hot' and 'cold' images
SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapColdID);
SetTbImageList(m_toolbar, TB_SETHOTIMAGELIST, nBitmapHotID);// if you don't want to use 'hot' images
SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapID);Tomasz Sowinski -- http://www.shooltz.com
- It's for protection
- Protection from what? Zee Germans?Thanx...i'll use that later to if you don't mind. :) "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
-
void SetTbImageList(CToolBar &tb, UINT nMessage, UINT nIDBitmap)
{
CImageList imageList;
CBitmap bitmap;bitmap.LoadBitmap(nIDBitmap); BITMAP bm; bitmap.GetBitmap(&bm); imageList.Create(bm.bmHeight, bm.bmHeight, ILC\_COLORDDB|ILC\_MASK, 0, 1); imageList.Add(&bitmap, RGB(255,0,255)); tb.SendMessage(nMessage, 0, (LPARAM)imageList.m\_hImageList); imageList.Detach(); bitmap.Detach();
}
// if you want to have 'hot' and 'cold' images
SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapColdID);
SetTbImageList(m_toolbar, TB_SETHOTIMAGELIST, nBitmapHotID);// if you don't want to use 'hot' images
SetTbImageList(m_toolbar, TB_SETIMAGELIST, nBitmapID);Tomasz Sowinski -- http://www.shooltz.com
- It's for protection
- Protection from what? Zee Germans? -
Is there a way to enable hicolor when using LoadToolBar? I dont want to create the tool bar from code.
Use LoadToolBar first - it'll assign command IDs to buttons. Then, call the routine I've posted to change images to hicolor. Tomasz Sowinski -- http://www.shooltz.com
- It's for protection
- Protection from what? Zee Germans? -
See following article - http://www.codeproject.com/docking/toolbar\_hotbuttons.asp