7,540
社区成员
发帖
与我相关
我的任务
分享
void CMainFrame::DockControlBarAtRight( CToolBar* Left, CToolBar* Right )
{
CRect rect;
DWORD dw;
UINT n;
// 让 MFC 调整所有浮动工具条的尺寸,以便GetWindowRect的到准确结果
RecalcLayout( TRUE );
Left->GetWindowRect( &rect );
rect.OffsetRect( 1, 0 );
dw = Left->GetBarStyle();
n = 0;
n = ( ( dw & CBRS_ALIGN_TOP ) ) ? AFX_IDW_DOCKBAR_TOP : n;
n = ( ( dw & CBRS_ALIGN_BOTTOM ) && n==0 ) ? AFX_IDW_DOCKBAR_BOTTOM : n;
n = ( ( dw & CBRS_ALIGN_LEFT ) && n==0 ) ? AFX_IDW_DOCKBAR_LEFT : n;
n = ( ( dw & CBRS_ALIGN_RIGHT ) && n==0 ) ? AFX_IDW_DOCKBAR_RIGHT : n;
// 当矩形使用默认参数时,DockControlBar 将在单独的一行里浮动工具条,
// 通过计算矩形的大小来模拟工具条拖动到指定位置实现浮动。
DockControlBar( Right, n, &rect );
}