CToolBar中SetButtonText怎么不显示
自己派生了一个CToolBar的子类CMyBar,是在对话框中(非文档类),然后动态创建的一个工具栏,而且用到了CImageList添加图片,调用SetButtonText没显示上面文字,怎么处理?高手,出下手吧。
假设图片大小24*24,共3个,第2个与第3个间有分隔条毕业论文 .
CMyBar m_wndMyBar;//成员变量
if (!m_wndMyBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_AUTOSIZE|TBSTYLE_TRANSPARENT, WS_CHILD | WS_VISIBLE | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_TOP | CBRS_SIZE_FIXED)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } UINT idlist[4] = {ID_RACE_SURV, ID_RACE_MUTE, 0, ID_RACE_ROBO}; m_wndMyBar.SetButtons(idlist, 4); m_wndMyBar.SetSizes(CSize(24 + 7, 24 + 6), CSize(24, 24)); TBADDBITMAP tbab = {AfxGetInstanceHandle(), IDB_THREERACE}; ::SendMessage(m_wndMyBar.m_hWnd, TB_ADDBITMAP, 3, (WPARAM)&tbab); m_wndMyBar.SetButtonText(0, "第一个"); m_wndMyBar.SetButtonText(1, "第二个"); m_wndMyBar.SetButtonText(3, "第三个"); WORD cx = LOWORD(m_wndMyBar.GetToolBarCtrl().GetButtonSize()); WORD cy = HIWORD(m_wndMyBar.GetToolBarCtrl().GetButtonSize()); m_wndMyBar.GetToolBarCtrl().SetButtonSize(CSize(cx, cy));
属性
m_ToolBar.ModifyStyle(0, BTNS_SHOWTEXT | TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_LIST);