第一次到公司实习,结果被分到开发部了,部门里除了男的就是电脑,55555555,不知道经理为啥不让我去做测试腻?????我是非常非常没经验的菜鸟一个
在此咨询各位大侠:
想做一个拆分界面,左边显示资源管理器一样的树形目录,左边资源管理器中的图片显示,这个怎么对应啊:点了左边的图片文件名,右边就显示相应的图片。
第一次发帖,所以给不了多少分哈,各位大侠见谅,o(∩_∩)o...
在此咨询各位大侠:
想做一个拆分界面,左边显示资源管理器一样的树形目录,左边资源管理器中的图片显示,这个怎么对应啊:点了左边的图片文件名,右边就显示相应的图片。
第一次发帖,所以给不了多少分哈,各位大侠见谅,o(∩_∩)o...
RUNTIME_CLASS(CMDIChildWnd), RUNTIME_CLASS(CView2))); 然后我们重载 CDocument::OnOpenDocument()函数;在该函数中定义如下变量:CCuteFTPView* pCuteFTPView、CView2* pView2、POSITION pos,并添加如下代码:pos=GetFirstViewPosition( )
while(pos!=NULL)
{
pView=GetNextView(pos);
if(pView->IsKindOf(RUNTIME_CLASS(CCuteFTPView))==NULL)
pCuteFTPView=(CCuteFTPView*)pView;
else
pView2=(CView2*)pView;
} 这样我们在文档类中就获的了跟它相连的所有的视图的指针。如果需要在 CCuteFTPView中调用CView2中的一个方法DoIt()则代码如下: CCuteFTPDoc* pDoc=GetDocument();
CView2* pView2=pDoc->pView2;
pView3.DoIt(); CView3和CView4都是不与文档相关联的。如何实现他们之间的通信呢。 正如我们在上面所说的那样,由于在主框架中我们可以访问任意的视图,因此我们的主要任务还是在程序中获得主框架的指针。例如下面的代码实现在CView3中访问CView4中的方法DoIt()。CMainFrame* MainFrame=(CMainFrame*)this->GetParent()->GetParent();
CView4* View4=(CView4*)MainFrame->m_wndSplitter1.GetPane(2,0);
View4->DoIt();
m_pLeftPaneView = (CLeftPaneView*)m_Splitter.GetPane(0,0);
m_pLeftPaneView->m_ListCtrlView = (CListCtrlView*)m_SplitterUD.GetPane(0,0);
m_pLeftPaneView->m_ListCtrlView->m_listDlg.m_pEditCtrlView = (CEditCtrlView*)m_SplitterUD.GetPane(1,0);
有了这个指针后你要怎样处理都可以了
int CUserManagerSplitterView::OnCreate(LPCREATESTRUCT lpCreateStruct)
...{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
if(!m_wndUserSplitter.CreateStatic(this, 1, 2))
...{
return FALSE;
} BOOL bRet = m_wndUserSplitter.CreateView(0, 0, RUNTIME_CLASS(CUserLeftPanView), CSize(200, 100), NULL);
if(!bRet)
...{
TRACE0("Failed to create left user pan!");
return FALSE;
} bRet = m_wndUserSplitter.CreateView(0, 1, RUNTIME_CLASS(CUserRightPanView), CSize(100, 100), NULL);
if(!bRet)
...{
TRACE0("Failed to create right user pan!");
return FALSE;
} m_wndUserSplitter.RecalcLayout();
return 0;
} 3.添加OnSize()响应,显示SplitterWnd:
void CUserManagerSplitterView::OnSize(UINT nType, int cx, int cy)
...{
CView::OnSize(nType, cx, cy); if(this->m_hWnd != NULL)
...{
CRect rect;
GetClientRect(&rect); if(m_wndUserSplitter.GetSafeHwnd() != NULL)
...{
m_wndUserSplitter.MoveWindow(&rect);
} }
}3.如果要Left Pan 与 Right Pan 可相互通信,参考以下代码:
//在CUserLeftPanView 中定义: CUserRightPanView *m_pUserRightPanView;
//然后在OnCreate后面添加:CUserLeftPanView* pUserLeftPanView = (CUserLeftPanView*)m_wndSplitter.GetPane(0, 0);
pUserLeftPanView->m_pRightPanView= (CUserRightPanView*)m_wndSplitter.GetPane(0, 1); 4.分割Frame方法一样;