首页
社区
课程
招聘
[求助]ReBar里的多个ToolBar的位置
发表于: 2010-8-23 22:13 4093

[求助]ReBar里的多个ToolBar的位置

2010-8-23 22:13
4093
在ReBar里创建了两个ToolBar,却总是只能在同一行显示,怎样才好创建时就设定为在两行显示的>
不用MoveWindow的话...
以下代码抄袭自网上流传的ReBar带Combo Box那段:
// Initialize structure members that both bands will share.
   rbBand.cbSize = sizeof(REBARBANDINFO);  // Required
   rbBand.fMask  = RBBIM_COLORS | RBBIM_TEXT | RBBIM_BACKGROUND |
                   RBBIM_STYLE | RBBIM_CHILD  | RBBIM_CHILDSIZE;
   rbBand.fStyle = RBBS_NOVERT | RBBS_CHILDEDGE | RBBS_FIXEDBMP;
   
   rbBand.hbmBack = NULL;

   // Create the toolbar control to be added.
   hwndTB = CreateToolbar(hwndOwner);	//Create ToolBar1

   // Get the height of the toolbar.
   dwBtnSize = (int)SendMessage(hwndTB, TB_GETBUTTONSIZE, 0,0);

   // Set values unique to the band with the toolbar.
   rbBand.lpText		= TEXT("Tool Bar");
   rbBand.hwndChild		= hwndTB;
   rbBand.cxMinChild	= 0;
   rbBand.cyMinChild	= HIWORD(dwBtnSize);
//   rbBand.cx			= 0;

   // Add the band that has the toolbar.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)0, (LPARAM)&rbBand);
   SendMessage(hwndRB, RB_SETBANDINFO, -1, (LPARAM)(LPREBARBANDINFO)&rbBand);
   
   //////////////////////////////////////////////////////////////////////////
   hToolBar = CCToolbarIMG(hwndOwner);	//Create ToolBar2
   // Set values unique to the band with the toolBar2.
   GetWindowRect(hToolBar, &rc);
   rbBand.lpText		= NULL;

   //rbBand.fStyle		= RBBS_BREAK;

   rbBand.hwndChild		= hToolBar;
   //rbBand.cxMinChild	= 0;
   rbBand.cxMinChild	= (WORD)SendMessage(hToolBar, TB_GETBUTTONSIZE, 0, 0)*SendMessage(hToolBar, TB_BUTTONCOUNT, 0, 0);
   rbBand.cyMinChild	= rc.bottom - rc.top;
   //rbBand.cx			= 100;
   rbBand.cx			= rbBand.cxMinChild;
   
   // Add the band that has the combo box.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)2, (LPARAM)&rbBand);
   SendMessage(hwndRB, RB_SETBANDINFO, 2, (LPARAM)(LPREBARBANDINFO)&rbBand);

   不知哪位做过的提个醒?

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//