!!!!!!!!!!!!!!!!!!!!关于多文档视图的问题,请高手看看!!!!
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!wndSplitter.CreateStatic(this, 1, 2)) return false;
//在这行动态创建了视图
if (!wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CBookView), CSize(0,0), pContext))
return false;
//if (!wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CSearch), CSize(0,0), pContext))
//return false;
DWORD dwf = CGfxOutBarCtrl::fDragItems|
CGfxOutBarCtrl::fEditGroups|
CGfxOutBarCtrl::fEditItems|
CGfxOutBarCtrl::fRemoveGroups|
CGfxOutBarCtrl::fRemoveItems|
CGfxOutBarCtrl::fAddGroups|
CGfxOutBarCtrl::fAnimation;
wndBar.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), &wndSplitter,
wndSplitter.IdFromRowCol(0, 0), dwf);
wndBar.SetOwner(this);
imaLarge.Create(IDB_IMAGELIST, 32, 0, RGB(128,128,128));
imaSmall.Create(IDB_SMALL_IMAGELIST, 16, 0, RGB(0,128,128));
wndBar.SetImageList(&imaLarge, CGfxOutBarCtrl::fLargeIcon);
wndBar.SetImageList(&imaSmall, CGfxOutBarCtrl::fSmallIcon);
wndTree.Create(WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS,
CRect(0,0,0,0), &wndBar, 1010);
wndTree.SetImageList(&imaSmall, TVSIL_NORMAL);
wndBar.SetAnimationTickCount(10);
wndBar.SetAnimSelHighlight(200);
wndBar.SetIfQueryRemove(true);
HTREEITEM htm = wndTree.InsertItem("1", 0,0);
HTREEITEM htm1 = wndTree.InsertItem("2", 1,1, htm);
wndTree.InsertItem("3", 1,1, htm);
wndBar.AddFolder("1", 0);
//wndBar.AddFolderBar("TreeBar", &wndTree);
wndBar.AddFolder("2", 1);
wndBar.AddFolder("3", 2);
wndBar.AddFolder("4", 3);
wndBar.InsertItem(0, 0, "11", 0, 0);
wndBar.InsertItem(0, 1, "12", 1, 0);
wndBar.InsertItem(0, 2, "13", 2, 0);
wndBar.InsertItem(1, 0, "21", 0, 0);
wndBar.InsertItem(1, 1, "22", 1, 0);
wndBar.InsertItem(1, 2, "23", 2, 0);
wndBar.InsertItem(1, 3, "24", 3, 0);
wndBar.InsertItem(2, 0, "31", 0, 0);
wndBar.InsertItem(2, 1, "32", 1, 0);
wndBar.InsertItem(2, 2, "33", 2, 0);
wndBar.InsertItem(3, 0, "41", 0, 0);
wndBar.InsertItem(3, 1, "42", 1, 0);
//wndBar.InsertItem(3, 2, "43", 2, 0);
wndBar.SetSelFolder(0);
CRect r;
GetClientRect(&r);
int w1 = r.Width()/5;
int w2 = r.Width()/4;
wndSplitter.SetColumnInfo( 0, w1, 0 );
wndSplitter.SetColumnInfo( 1, w2, 0 );
wndSplitter.RecalcLayout();
//return true;
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
}
long CMainFrame::OnOutBarNotify(WPARAM wParam, LPARAM lParam)
{
switch (wParam)
{
case NM_OB_ITEMCLICK:
// cast the lParam to an integer to get the clicked item
{
int index = (int) lParam;
CString cs, cs1;
cs1 = wndBar.GetItemText(index);
int iFloder = wndBar.GetSelFolder();
cs.Format("Clicked on %d Floder -> %d :: <%s>", iFloder, (int)lParam, cs1);
AfxMessageBox(cs);
(rect,NULL,RDW_INVALIDATE|RDW_UPDATENOW);
}
return 0;
}
这段代码是创建一个类似OUTLOOK的BAR,我想在响应在BAR的按钮上点击进显示相应的FORM,请问如何实现,我已经做好了几个FORM了.请大家帮帮忙,我在线等待