工具栏加载按钮位图,
VERIFY(AddBitmap(m_nButtonCount,IDB_TOOLBAR) != -1); //添加位图
....
//加载工具条
m_StandardBar.Create(WS_BORDER|WS_VISIBLE|WS_CHILD|TBSTYLE_WRAPABLE
|CCS_TOP|CCS_ADJUSTABLE,CRect(0,0,0,0),this,IDB_TOOLBAR)
这样加载256色位图是可以的,但是如果是24为的bmp图片就运行不了,请问各位有什么办法加载24位的图标
VERIFY(AddBitmap(m_nButtonCount,IDB_TOOLBAR) != -1); //添加位图
....
//加载工具条
m_StandardBar.Create(WS_BORDER|WS_VISIBLE|WS_CHILD|TBSTYLE_WRAPABLE
|CCS_TOP|CCS_ADJUSTABLE,CRect(0,0,0,0),this,IDB_TOOLBAR)
这样加载256色位图是可以的,但是如果是24为的bmp图片就运行不了,请问各位有什么办法加载24位的图标
看看行不行
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!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.
bitmap.LoadBitmap(IDB_TOOLBAR_COLD);
imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
imageList.Add(&bitmap, RGB(255,0,255));
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_TOOLBAR_HOT);
imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
imageList.Add(&bitmap, RGB(255,0,255));
m_wndToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
imageList.Detach();
bitmap.Detach(); // TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);所需用到的工具TBCreator,用于生成两个BMP图片。
把两个图片加入到RESOURCE。