MDI程序,CReBar 动态创建两个控件,装载后出现问题1)发现两个控件间隔过大,有什么方法可以紧密排列。
2)控件可不可保持大小不变,不随工具栏变动 CEdit* pEdit = new CEdit();
pEdit->Create(WS_CHILD|WS_VISIBLE, CRect(0,0,100,20),this, 0);

CEdit* pEdit2 = new CEdit();
pEdit2->Create(WS_CHILD|WS_VISIBLE, CRect(0,0,100,20),this, 0); m_wndReBar.AddBar(pEdit,NULL,NULL, RBBS_NOGRIPPER);
m_wndReBar.AddBar(pEdit2,NULL,NULL, RBBS_NOGRIPPER);        这样装载第一个控件会自动改变大小,但后一个可以不变(有什么方法让第一个也不改变大小)

解决方案 »

  1.   

    回复 afairycell 试了
    SetWindowPos
    MoveWindow
    都不行!
    还有什么方法吗?
      

  2.   

    MFC不清楚,WTL可以这样排列:   for( UINT j = 0; j < m_Rebar.GetBandCount(); j++ ) {
          REBARBANDINFO rbi = { 0 };
          rbi.cbSize = sizeof(REBARBANDINFO);
          rbi.fMask = RBBIM_CHILD;
          m_Rebar.GetBandInfo(j, &rbi);
          if( rbi.hwndChild != hWnd ) continue;
          if( ::IsWindowVisible(hWnd) == bShow ) return TRUE;
          m_Rebar.ShowBand(j, bShow);
          if( bShow ) {
             m_Rebar.MaximizeBand(j);
             m_Rebar.SendMessage(RB_MAXIMIZEBAND, j, 1L);
          }
      

  3.   

    回复 r3000 好像不能互通,放代码入去编译很多函数在MFC中没有定义。
    大家有没有简一点的方法。
      

  4.   


    机器里木有MFC这个垃圾,但是一般都有对应的,可能函数名字不一样,
    肯定可以互通的。
      

  5.   


    放在 MDI OnCreate函数后面 编译出现这样的错误,要怎么办?GetBandCount' : is not a member of 'CReBar
    GetBandInfo' : is not a member of 'CReBar'
    'hWnd' : undeclared identifier
    'bShow' : undeclared identifier
    ShowBand' : is not a member of 'CReBar'
    MaximizeBand' : is not a member of 'CReBar'