首页上一页 1 下一页尾页 1 条记录 1/1页
vc++入门到精通 第二十章图书馆管理系统 为什么工具栏的背景图片加载不了
发表在VC++答疑区
2015-04-09
是否精华
是
否
版块置顶:
是
否
if(!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS |CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
{
return FALSE;
}
CImageList ImageList;
ImageList.Create(32, 32, ILC_COLOR24|ILC_MASK,2,2);
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON8));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON9));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON10));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON4));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON5));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON6));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON7));
m_ToolBar.GetToolBarCtrl().SetImageList(&ImageList);
ImageList.Detach();
m_ToolBar.SetButtons(NULL, 10); //共10个按钮
// 设置每个工具按钮文字
m_ToolBar.SetButtonInfo(0, ID_32772, TBSTYLE_BUTTON, 0);
m_ToolBar.SetButtonText(0, "图书信息");
m_ToolBar.SetButtonInfo(1, ID_32771, TBSTYLE_BUTTON , 1);
m_ToolBar.SetButtonText(1, "用户信息");
m_ToolBar.SetButtonInfo(2, ID_SEPARATOR, TBBS_SEPARATOR , 1);
m_ToolBar.SetButtonInfo(3, ID_32778, TBSTYLE_BUTTON, 2);
m_ToolBar.SetButtonText(3, "图书入库");
m_ToolBar.SetButtonInfo(4, ID_32783, TBSTYLE_BUTTON , 3);
m_ToolBar.SetButtonText(4, "图书销售");
m_ToolBar.SetButtonInfo(5, ID_SEPARATOR, TBBS_SEPARATOR , 5);
m_ToolBar.SetButtonInfo(6, ID_32786, TBSTYLE_BUTTON , 4);
m_ToolBar.SetButtonText(6, "入库查询");
m_ToolBar.SetButtonInfo(7, ID_32788, TBSTYLE_BUTTON, 5);
m_ToolBar.SetButtonText(7, "销售查询");
m_ToolBar.SetButtonInfo(8, ID_SEPARATOR, TBBS_SEPARATOR , 6);//
m_ToolBar.SetButtonInfo(9, IDCANCEL, TBSTYLE_BUTTON, 6);
m_ToolBar.SetButtonText(9, "退出系统");
m_ToolBar.SetSizes(CSize(60,60), CSize(32,32));
m_Rebar.Create(this);
//将向导生成的工具栏做目标工具栏
m_Rebar.AddBar(&m_ToolBar);
m_Rebar.RedrawWindow();
REBARBANDINFO info={0};
info.cbSize = sizeof(info);
info.fMask = RBBIM_BACKGROUND;
m_ToolBar.ModifyStyle(0,TBSTYLE_TRANSPARENT);
info.hbmBack =LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP7));
//m_Rebar.RedrawWindow();
m_Rebar.GetReBarCtrl().SetBandInfo(0,&info);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
| CBRS_TOOLTIPS |CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
{
return FALSE;
}
CImageList ImageList;
ImageList.Create(32, 32, ILC_COLOR24|ILC_MASK,2,2);
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON8));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON9));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON10));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON4));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON5));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON6));
ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON7));
m_ToolBar.GetToolBarCtrl().SetImageList(&ImageList);
ImageList.Detach();
m_ToolBar.SetButtons(NULL, 10); //共10个按钮
// 设置每个工具按钮文字
m_ToolBar.SetButtonInfo(0, ID_32772, TBSTYLE_BUTTON, 0);
m_ToolBar.SetButtonText(0, "图书信息");
m_ToolBar.SetButtonInfo(1, ID_32771, TBSTYLE_BUTTON , 1);
m_ToolBar.SetButtonText(1, "用户信息");
m_ToolBar.SetButtonInfo(2, ID_SEPARATOR, TBBS_SEPARATOR , 1);
m_ToolBar.SetButtonInfo(3, ID_32778, TBSTYLE_BUTTON, 2);
m_ToolBar.SetButtonText(3, "图书入库");
m_ToolBar.SetButtonInfo(4, ID_32783, TBSTYLE_BUTTON , 3);
m_ToolBar.SetButtonText(4, "图书销售");
m_ToolBar.SetButtonInfo(5, ID_SEPARATOR, TBBS_SEPARATOR , 5);
m_ToolBar.SetButtonInfo(6, ID_32786, TBSTYLE_BUTTON , 4);
m_ToolBar.SetButtonText(6, "入库查询");
m_ToolBar.SetButtonInfo(7, ID_32788, TBSTYLE_BUTTON, 5);
m_ToolBar.SetButtonText(7, "销售查询");
m_ToolBar.SetButtonInfo(8, ID_SEPARATOR, TBBS_SEPARATOR , 6);//
m_ToolBar.SetButtonInfo(9, IDCANCEL, TBSTYLE_BUTTON, 6);
m_ToolBar.SetButtonText(9, "退出系统");
m_ToolBar.SetSizes(CSize(60,60), CSize(32,32));
m_Rebar.Create(this);
//将向导生成的工具栏做目标工具栏
m_Rebar.AddBar(&m_ToolBar);
m_Rebar.RedrawWindow();
REBARBANDINFO info={0};
info.cbSize = sizeof(info);
info.fMask = RBBIM_BACKGROUND;
m_ToolBar.ModifyStyle(0,TBSTYLE_TRANSPARENT);
info.hbmBack =LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP7));
//m_Rebar.RedrawWindow();
m_Rebar.GetReBarCtrl().SetBandInfo(0,&info);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);