15,979
社区成员
发帖
与我相关
我的任务
分享
if (!m_wndToolBar.CreateEx(this, TBSTYLE_LIST, WS_CHILD | WS_VISIBLE | CBRS_TOP // 主工具栏 zhang flat-->list
| 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
}
this->SetMenu(&m_ImageMainMenu);
m_wndStatusBar.SetPaneInfo(4,IDC_STATUSBAR,SBT_NOBORDERS,38);
// 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);
//the next program from bcuZhang
m_wndToolBar.SetButtonText(0, "打开");
m_wndToolBar.SetButtonText(1, "关闭");
m_wndToolBar.SetButtonText(3, "处理");
m_wndToolBar.SetButtonText(5, "浏览");
m_wndToolBar.SetButtonText(6, "停止浏览");
m_wndToolBar.SetButtonText(7, "向上");
m_wndToolBar.SetButtonText(8, "向下");
m_wndToolBar.SetButtonText(9, "向左");
m_wndToolBar.SetButtonText(10, "向右");
m_wndToolBar.SetButtonText(11, "锁定");
m_wndToolBar.SetButtonText(12, "时间");
m_wndToolBar.SetButtonText(13, "网格");
m_wndToolBar.SetButtonText(15, "加工");
m_wndToolBar.SetButtonText(16, "停止");
m_wndToolBar.SetButtonText(18, "p动");
m_wndToolBar.SetButtonText(19, "f动");
m_wndToolBar.SetButtonText(20, "粉");
m_wndToolBar.SetButtonText(21, "停粉");
m_wndToolBar.SetButtonText(23, "抽");
m_wndToolBar.SetButtonText(24, "停抽");
m_wndToolBar.SetButtonText(26, "关于");
CRect rect;
m_wndToolBar.GetItemRect(0, rect);
m_wndToolBar.SetSizes(rect.Size(), CSize(22, 16));
//the program from bcuZhang end
m_wndToolBar1.CreateEx(this, TBSTYLE_FLAT , WS_CHILD | WS_VISIBLE |
CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// if text at right
// m_wndToolBar1.ModifyStyle(0,TBSTYLE_LIST);
// set bmp
m_bmToolbar.LoadBitmap(IDB_COLOR);
m_wndToolBar1.SetBitmap((HBITMAP)m_bmToolbar);
// cmd ID
UINT IDArray[]={ID_BT_1,ID_SEPARATOR,ID_BT_2,ID_SEPARATOR,
ID_BT_3,ID_SEPARATOR,ID_BT_4,ID_SEPARATOR,
ID_BT_5,ID_SEPARATOR,ID_BT_6,ID_SEPARATOR,
ID_BT_7,ID_SEPARATOR,ID_BT_8,ID_SEPARATOR,ID_BT_9};
int nIDCount = sizeof(IDArray)/sizeof(UINT);
m_wndToolBar1.SetButtons(IDArray,nIDCount);
for(int jj=0;jj<nIDCount;jj++)
{// have to be inside 'for' !!! if text under img
m_wndToolBar1.SetSizes(CSize(40,40),CSize(16,15));
if (m_wndToolBar1.GetButtonStyle(jj) == TBBS_SEPARATOR) continue;
m_wndToolBar1.SetButtonText(jj,"测试");
}
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);