⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wndseparateview.cpp

📁 用MFC进行编程 实现窗口的分割 是一个客户区分割成两个 利于别的操作
💻 CPP
字号:
// WndSeparateView.cpp : implementation of the CWndSeparateView class
//

#include "stdafx.h"
#include "WndSeparate.h"

#include "WndSeparateDoc.h"
#include "WndSeparateView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CWndSeparateView

IMPLEMENT_DYNCREATE(CWndSeparateView, CView)

BEGIN_MESSAGE_MAP(CWndSeparateView, CView)
	//{{AFX_MSG_MAP(CWndSeparateView)
	ON_WM_CREATE()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWndSeparateView construction/destruction

CWndSeparateView::CWndSeparateView()
{
	// TODO: add construction code here

}

CWndSeparateView::~CWndSeparateView()
{
}

BOOL CWndSeparateView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CWndSeparateView drawing

void CWndSeparateView::OnDraw(CDC* pDC)
{
	CWndSeparateDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CWndSeparateView printing

BOOL CWndSeparateView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CWndSeparateView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CWndSeparateView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CWndSeparateView diagnostics

#ifdef _DEBUG
void CWndSeparateView::AssertValid() const
{
	CView::AssertValid();
}

void CWndSeparateView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CWndSeparateDoc* CWndSeparateView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWndSeparateDoc)));
	return (CWndSeparateDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CWndSeparateView message handlers

int CWndSeparateView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here


	m_SplitterWnd.CreateStatic(this,1,2);
	m_SplitterWnd.CreateView(0,0,RUNTIME_CLASS(CTOCVIEW),CSize(200,0),NULL);
	m_SplitterWnd.CreateView(0,1,RUNTIME_CLASS(CMAPVIEW),CSize(0,0),NULL);

	return 0;
}

void CWndSeparateView::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	m_SplitterWnd.MoveWindow(CRect(0,0,cx,cy));

}

void CWndSeparateView::OnInitialUpdate() 
{
	CView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	CTOCVIEW * pTOC=(CTOCVIEW *)m_SplitterWnd.GetPane(0,0);
	CMAPVIEW * pMAP=(CMAPVIEW *)m_SplitterWnd.GetPane(0,1);
	pTOC->m_TOCControl.SetBuddyControl(pMAP->m_MapControl.GetObject());
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -