创建时指定了什么风格?
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.
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.
更正,更正:
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时,取出的位置就是正确的.
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] );
}