本文共 2494 字,大约阅读时间需要 8 分钟。
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; } 转载地址:http://kikmi.baihongyu.com/