主框架類 CMainFrame::OnCreate 中:
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);註釋或刪除上述三行,工具欄將固定在創建位置,無拖拽手柄,用戶無法拖動。
若需保留停靠但隱藏手柄,可重寫 CControlBar::OnPaint 不繪製 gripper,或使用 CMFCToolBar 設置 SetShowGripper(FALSE)。