您的位置:首页 > 其它

SDI程序中,如何在主框架上切换不同的视图

2013-06-07 17:15 489 查看
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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: