代码如下,请高手指点!
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to create splitter window\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CWCAPPView),
CSize(0, 0), pContext))
{
TRACE0("Failed to create CWCAPPView\n");
return FALSE;
}
DWORD dwStyle =
CGfxOutBarCtrl::fDragItems |
CGfxOutBarCtrl::fEditGroups |
CGfxOutBarCtrl::fEditItems |
CGfxOutBarCtrl::fRemoveGroups |
CGfxOutBarCtrl::fRemoveItems |
CGfxOutBarCtrl::fAddGroups |
CGfxOutBarCtrl::fAnimation;
if (!m_wndOutlookBar.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0),
&m_wndSplitter, m_wndSplitter.IdFromRowCol(0, 0), dwStyle))
{
TRACE0("Failed to create outlook bar.");
return FALSE;
}
m_wndOutlookBar.SetOwner(this);
// Here we create the imagelists for the control
m_ImageSmall.Create (16, 16, TRUE, 2, 1); //透明&& 256色
m_ImageLarge.Create (32, 32, TRUE, 2, 1); for( int nIcon = IDI_ICON1; nIcon <= IDI_ICON4; ++nIcon )
{
HICON hIcon = AfxGetApp()->LoadIcon(nIcon); //获得图标句柄
ASSERT(hIcon); m_ImageSmall.Add(hIcon);
m_ImageLarge.Add(hIcon);
} // and we link them to the control
m_wndOutlookBar.SetImageList(&m_ImageLarge, CGfxOutBarCtrl::fLargeIcon);
m_wndOutlookBar.SetImageList(&m_ImageSmall, CGfxOutBarCtrl::fSmallIcon); m_wndOutlookBar.AddFolder(_T("功能模块"), FOLDER_0); m_wndOutlookBar.InsertItem(FOLDER_0, CMD_00, _T("HDLC"), 0, 0);
m_wndOutlookBar.InsertItem(FOLDER_0, CMD_01, _T("IP"), 1, 0);
m_wndOutlookBar.InsertItem(FOLDER_0, CMD_02, _T("TCP"), 2, 0);
m_wndOutlookBar.InsertItem(FOLDER_0, CMD_03, _T("UDP"), 3, 0);
m_wndOutlookBar.SetSelFolder(0); CRect r;
GetClientRect(&r);
int w1 = r.Width()/7;
int w2 = r.Width()/5;
m_wndSplitter.SetColumnInfo( 0, w1, 0 );
m_wndSplitter.SetColumnInfo( 1, w2, 0 );
m_wndSplitter.RecalcLayout();
return TRUE;//CFrameWnd::OnCreateClient(lpcs, pContext);
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to create splitter window\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CWCAPPView),
CSize(0, 0), pContext))
{
TRACE0("Failed to create CWCAPPView\n");
return FALSE;
}
DWORD dwStyle =
CGfxOutBarCtrl::fDragItems |
CGfxOutBarCtrl::fEditGroups |
CGfxOutBarCtrl::fEditItems |
CGfxOutBarCtrl::fRemoveGroups |
CGfxOutBarCtrl::fRemoveItems |
CGfxOutBarCtrl::fAddGroups |
CGfxOutBarCtrl::fAnimation;
if (!m_wndOutlookBar.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0),
&m_wndSplitter, m_wndSplitter.IdFromRowCol(0, 0), dwStyle))
{
TRACE0("Failed to create outlook bar.");
return FALSE;
}
m_wndOutlookBar.SetOwner(this);
// Here we create the imagelists for the control
m_ImageSmall.Create (16, 16, TRUE, 2, 1); //透明&& 256色
m_ImageLarge.Create (32, 32, TRUE, 2, 1); for( int nIcon = IDI_ICON1; nIcon <= IDI_ICON4; ++nIcon )
{
HICON hIcon = AfxGetApp()->LoadIcon(nIcon); //获得图标句柄
ASSERT(hIcon); m_ImageSmall.Add(hIcon);
m_ImageLarge.Add(hIcon);
} // and we link them to the control
m_wndOutlookBar.SetImageList(&m_ImageLarge, CGfxOutBarCtrl::fLargeIcon);
m_wndOutlookBar.SetImageList(&m_ImageSmall, CGfxOutBarCtrl::fSmallIcon); m_wndOutlookBar.AddFolder(_T("功能模块"), FOLDER_0); m_wndOutlookBar.InsertItem(FOLDER_0, CMD_00, _T("HDLC"), 0, 0);
m_wndOutlookBar.InsertItem(FOLDER_0, CMD_01, _T("IP"), 1, 0);
m_wndOutlookBar.InsertItem(FOLDER_0, CMD_02, _T("TCP"), 2, 0);
m_wndOutlookBar.InsertItem(FOLDER_0, CMD_03, _T("UDP"), 3, 0);
m_wndOutlookBar.SetSelFolder(0); CRect r;
GetClientRect(&r);
int w1 = r.Width()/7;
int w2 = r.Width()/5;
m_wndSplitter.SetColumnInfo( 0, w1, 0 );
m_wndSplitter.SetColumnInfo( 1, w2, 0 );
m_wndSplitter.RecalcLayout();
return TRUE;//CFrameWnd::OnCreateClient(lpcs, pContext);
}
解决方案 »
- 怎么把3DS文件导入OpenGL???请高手详解
- 高手帮忙看看这段图形显示的代码有没内存泄漏
- 高分求解一字符转换的问题?
- 请问一下,在vc里,怎么实现多图片浏览啊!
- 关于广播和arp?
- 但是如何能够让IE每次只download文件的指定部分?
- windows 2000 下 “抓屏” 的问题,急
- 大家好!有人知道怎样做灰化菜单吗?我要没有读入某个文件时菜单无效,当读入文件后菜单才激活!
- 在CreateWindow()时,第一个参数除了"edit","static","botton"还有哪些?
- 请教各位,如何才能读取OutLook中的地址薄的用户信息
- 我的程序知道一个应用程序的句柄,如何使该应用程序得到焦点?
- 谁有关于编译器好得文章啊,介绍编译器得作用,背景,原理什么得,很急啊,谢谢
还有其他的方式切换多个VIEW吗?
CDocument *pDoc=GetActiveDocument();
CView *pOldView=GetActiveView();
CView *pNewView; pNewView=(CView*)new CFormListView;
pNewView->Create(NULL,"",AFX_WS_DEFAULT_VIEW,
rectDefault,this,AFX_IDW_PANE_FIRST,NULL);
pNewView->OnInitialUpdate();
pNewView->ShowWindow(SW_SHOW);
pOldView->ShowWindow(SW_HIDE);
pDoc->AddView(pNewView);
pDoc->RemoveView(pOldView);
SetActiveView(pNewView);
RecalcLayout();
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 flag=wndBar.GetFolderData();
if(flag==0)//判断是否为第一个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==1) //响应第二个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView2),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==2) //响应第三个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView3),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
else if(flag==1)//判断是否为第二个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView4),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==1)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView5),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==2)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView6),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==3)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView7),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
else if(flag==2)//判断是否为第三个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView8),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
}
return 0;
case NM_OB_ONLABELENDEDIT:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited item
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Editing item %d, new text:%s\n", pOI->index, pOI->cText);
}
return 1;
case NM_OB_ONGROUPENDEDIT:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited folder
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Editing folder %d, new text:%s\n", pOI->index, pOI->cText);
}
return 1;
case NM_OB_DRAGITEM:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the dragged items
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Drag item %d at position %d\n", pOI->iDragFrom, pOI->iDragTo);
}
return 1;
}
return 0;
}