分类:
2009-11-13 11:08:39
工具栏设计
if (!m_wndToolBar.CreateEx(this,WS_CHILD| CBRS_TOOLTIPS|CBRS_FLOATING| WS_VISIBLE | CBRS_ALIGN_TOP|TBSTYLE_FLAT))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_wndToolBar.SetButtons(NULL,13);
int record = 0;
CString menutext;
CCHAR* c_temp;
for(int m=0;m<13;m++)
{
if((m+1)%3==0)
m_wndToolBar.SetButtonStyle(m,TBBS_SEPARATOR);
else
{
m_wndToolBar.SetButtonInfo(m,ID_Set_disPlay+record,TBBS_BUTTON,record);
menutext.LoadString(ID_Set_disPlay+record);
record+=1;
c_temp=menutext.GetBuffer(menutext.GetLength()+1);
c_temp[menutext.GetLength()+1]='\n';
//m_wndToolBar.SetButtonText(m,c_temp);
}
}
m_wndToolBar.SetButtonText(0,"视频采集");
m_wndToolBar.SetButtonText(1,"关闭视频");
m_wndToolBar.SetButtonText(3,"视频格式");
m_wndToolBar.SetButtonText(4,"综合设定");
m_wndToolBar.SetButtonText(6,"录像");
m_wndToolBar.SetButtonText(7,"数据备份");
m_wndToolBar.SetButtonText(9,"数据还原");
m_wndToolBar.SetButtonText(10,"会议记录");
m_wndToolBar.SetButtonText(12,"会议查询");
m_wndToolBar.GetToolBarCtrl().SetButtonSize(CSize(60,55));
//m_wndToolBar.GetToolBarCtrl().SetButtonWidth(30,60);
m_toolimages.Create(28,28,ILC_COLOR16|ILC_MASK,0,0);
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON4));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON5));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON6));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON7));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON8));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON9));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON10));
m_wndToolBar.GetToolBarCtrl().SetHotImageList(&m_toolimages);
m_toolimages.Detach();
m_toolimages.Create(32,32,ILC_COLOR32|ILC_MASK,1,1);
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON16));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON18));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON19));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON20));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON21));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON22));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON23));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON24));
m_toolimages.Add(AfxGetApp()->LoadIcon(IDI_ICON25));
m_wndToolBar.GetToolBarCtrl().SetImageList(&m_toolimages);
m_toolimages.Detach(); //释放图像列表对象
m_wndReBar.Create(this);//首先创建一个CReBar对象
m_wndReBar.AddBar(&m_wndToolBar);//将新建的ToolBar或者其他窗口加入到ReBar中
REBARBANDINFO rbbi;
rbbi.cbSize = sizeof(rbbi); //这个是必须填
rbbi.fMask = RBBIM_BACKGROUND;
m_wndToolBar.ModifyStyle( 0,TBSTYLE_TRANSPARENT);//工具栏设为透明
//下面这行代码是为工具条加入背景位图,请注意上rbbi.fMask中RBBIM_BACKGROUND标志
rbbi.hbmBack = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP1));
//设置属性
m_wndReBar.GetReBarCtrl().SetBandInfo(0, &rbbi);