www.pudn.com > DialogBar调用切分窗口.rar > dlgbar.cpp


// dlgbar.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "task.h" 
#include "dlgbar.h" 
#include "leftView.h" 
#include "RightView.h" 
#include "MainFrm.h" 
#include "ChildFrm.h" 
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// Cdlgbar dialog 
 
 
Cdlgbar::Cdlgbar(CWnd* pParent /*=NULL*/) 
//	: CDialogBar(Cdlgbar::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(Cdlgbar) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void Cdlgbar::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialogBar::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(Cdlgbar) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(Cdlgbar, CDialogBar) 
	//{{AFX_MSG_MAP(Cdlgbar) 
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1) 
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// Cdlgbar message handlers 
 
void Cdlgbar::OnButton1()  
{ 
	// TODO: Add your control notification handler code here 
	CMainFrame *pmain=(CMainFrame *)AfxGetMainWnd(); 
	CChildFrame *pchild=(CChildFrame *)pmain->GetActiveFrame(); 
	CLeftView *pleft=(CLeftView *)pchild->GetActiveView(); 
	pchild->SetActiveView((CRightView *)pchild->m_wndSplitter.GetPane(0,1),FALSE); 
	CRightView *pright=(CRightView *)pchild->GetActiveView(); 
	CClientDC dc(pright); 
	pright->OnPrepareDC(&dc); 
 
	POSITION pos=pleft->m_ptList.GetHeadPosition(); 
	while(pos!=NULL) 
	{ 
		Cmyline *myline=pleft->m_ptList.GetNext(pos); 
		dc.MoveTo(myline->pt); 
		dc.LineTo(myline->pt1); 
	} 
	pchild->SetActiveView((CLeftView *)pchild->m_wndSplitter.GetPane(0,0),FALSE); 
 
 
} 
 
void Cdlgbar::OnButton2()  
{ 
	// TODO: Add your control notification handler code here 
	CMainFrame *pmain=(CMainFrame *)AfxGetMainWnd(); 
	CChildFrame *pchild=(CChildFrame *)pmain->GetActiveFrame(); 
	CLeftView *pleft=(CLeftView *)pchild->GetActiveView(); 
	POSITION pos=pleft->m_ptList.GetHeadPosition(); 
	while(pos!=NULL) 
	{ 
		delete pleft->m_ptList.GetNext(pos); 
	} 
	pleft->m_ptList.RemoveAll(); 
	CTaskDoc *pdoc=(CTaskDoc *)pchild->GetActiveDocument(); 
	pdoc->UpdateAllViews(NULL,0L,NULL); 
}