How do I place toolbar with 24bit color on the dialog?
It seems that the following code places the toolbar on the dialog but draws the icons found in the toolbar resource instead of image list that I supply. What do I do wrong?
BOOL CMyClass::OnInitDialog() { if (!InitCommandBars()) // this implemented in this class instead of calling the CodeJock library return FALSE;
RedrawWindow(0, 0, RDW_ALLCHILDREN|RDW_INVALIDATE); CXTPCommandBars* pCommandBars = m_pCommandBars; CXTPToolBar* pToolBar = pCommandBars->Add(_T("Standard"), xtpBarTop);
CBitmap bmp;bmp.
LoadBitmap( IDB_BT_TOOLBAR ); m_ToolbarImageList.Create( 16,15,ILC_COLORDDB|ILC_MASK,7,1); m_ToolbarImageList.Add( &bmp, RGB(255,0,255) ); pToolBar->SendMessage( TB_SETIMAGELIST, 0, (LPARAM)m_ToolbarImageList.m_hImageList ); pToolBar->LoadToolBar(IDR_BT_TOOLBAR);
((CXTPControlButton*)pToolBar->GetControls()->FindControl(xtpControlButton, ID_BT_DISCONNECT, TRUE, FALSE))->SetStyle(xtpButtonIconAndCaption);
((CXTPControlButton*)pToolBar->GetControls()->FindControl(xtpControlButton, ID_BT_MAKEDIR, TRUE, FALSE))->SetStyle(xtpButtonIconAndCaption);
((CXTPControlButton*)pToolBar->GetControls()->FindControl(xtpControlButton, ID_BT_PUT, TRUE, FALSE))->SetStyle(xtpButtonIconAndCaption);
((CXTPControlButton*)pToolBar->GetControls()->FindControl(xtpControlButton, ID_BT_GET, TRUE, FALSE))->SetStyle(xtpButtonIconAndCaption);
((CXTPControlButton*)pToolBar->GetControls()->FindControl(xtpControlButton, ID_BT_TOGGLE_VIEW, TRUE, FALSE))->SetStyle(xtpButtonIconAndCaption);
((CXTPControlButton*)pToolBar->GetControls()->FindControl(xtpControlButton, ID_BT_SHOW_IMG, TRUE, FALSE))->SetStyle(xtpButtonIconAndCaption);
pToolBar->GetControls()->CreateOriginalControls();
pCommandBars->GetImageManager()->SetIcons(IDR_BT_TOOLBAR);
XTPImageManager()->SetIcons(IDR_MAINFRAME);
pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault);
pCommandBars->GetToolTipContext()->SetStyle(xtpToolTipOffice);
LoadCommandBars(_T("CommandBars"));
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
|