int MFC_Tutorial_Window::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;
if (!myBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
{
MessageBox(L"Failed to create toolbar\n");
return -1; // fail to create
}
CImageList img; CString str;
myBar.GetToolBarCtrl().SetButtonWidth(150,250);
myBar.GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
bool b = img.Create(IDB_COLDBITMAP, 22, 0, RGB(255, 0, 255));
myBar.GetToolBarCtrl().SetHotImageList(&img);
//img.Detach();
myBar.ModifyStyle(0, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT);
myBar.SetButtons(NULL, 5);
myBar.SetButtonInfo(0, IDB_BITMAP1, TBSTYLE_BUTTON |TBSTYLE_DROPDOWN |TBBS_AUTOSIZE , 0);
b = myBar.SetButtonText(0,L"ABC");
myBar.SetSizes(CSize(42,38),CSize(16,15));
myBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&myBar);
}
above code is showing toolbar without text.what to do to get text text is displaying when i move toolbar from one position to other during runtime but not at first time :(