用AppWizard刚生成的一个MDI程序,只是View用的是CRichEditView。然后增加一个CDialogBar对应的Dialog资源,加上DialogBar的代码如下:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1; EnableDocking(CBRS_ALIGN_ANY);

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1;      // fail to create
} if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
  sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;      // fail to create
}
if (!m_wndProjTreeDlgBar.Create(this, IDD_DLG_PROJTREE, CBRS_LEFT | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_BORDER_RIGHT | CBRS_SIZE_DYNAMIC, IDD_DLG_PROJTREE))
{
TRACE0("failed to create Project Tree DialogBar\n");
return -1;
} // TODO: Delete these three lines if you don't want the toolbar to
//  be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar); m_wndProjTreeDlgBar.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndProjTreeDlgBar);

return 0;
}执行该程序时,改变左边CDialogBar时(来回拉动中间的竖杠)总出现很多竖条画面,非常不美观。