创建时指定了什么风格?
CBRS_ALIGN_TOP   Allows the control bar to be docked to the top of the client area of a frame window.
CBRS_ALIGN_BOTTOM   Allows the control bar to be docked to the bottom of the client area of a frame window.
CBRS_ALIGN_LEFT   Allows the control bar to be docked to the left side of the client area of a frame window.
CBRS_ALIGN_RIGHT   Allows the control bar to be docked to the right side of the client area of a frame window.
CBRS_ALIGN_ANY   Allows the control bar to be docked to any side of the client area of a frame window.

解决方案 »

  1.   

    CBRS_ALIGN_RIGHT这根创建时什么风格没有关系,用DockControlBar (...)它会做一切。
      

  2.   

    DockControlBar()只能Dock ControlBar到风格CBRS_ALIGN_xxx指定的可停靠的边界。
      

  3.   

    对不起,对不起:
    更正,更正:
    int   n=CBRS_ALIGN_RIGHT;for(i=0;i<4;i++)
    {
        myToolBar[i]->EnableDocking( CBRS_ALIGN_ANY);
        DockControlBar( m_yToolBar[i] , n );
        RecalcLayout();
        myToolBar[i]->GetWindowRect( rc[i] );    
    }取出每一个工具条的位置存于 rc 数组中,结果是 rc 中的值都一样( 从0 到 3);但当 n=CBRS_ALIGN_LEFT时,取出的位置就是正确的.
      

  4.   

    分成两步试试
    for(i=0;i<4;i++)
    {
        myToolBar[i]->EnableDocking( CBRS_ALIGN_ANY);
        DockControlBar( m_yToolBar[i] , n );}
       RecalcLayout();
    for(i=0;i<4;i++)
    {
       myToolBar[i]->GetWindowRect( rc[i] );    
    }
      

  5.   

    dock之后原来的工具栏位置变了