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

📄 mdispview.cpp

📁 view 下窗口切分
💻 CPP
字号:
// MDISpView.cpp : implementation of the CMDISpView class
//

#include "stdafx.h"
#include "MDISp.h"


#include "MDISpDoc.h"
#include "MDISpView.h"
#include "TestView.h"
#include "ChildFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMDISpView

IMPLEMENT_DYNCREATE(CMDISpView, CView)

BEGIN_MESSAGE_MAP(CMDISpView, CView)
	//{{AFX_MSG_MAP(CMDISpView)
	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()

/////////////////////////////////////////////////////////////////////////////
// CMDISpView construction/destruction

CMDISpView::CMDISpView()
{
	// TODO: add construction code here
	m_bInitialized = false;
}

CMDISpView::~CMDISpView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMDISpView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CMDISpView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMDISpView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMDISpView message handlers

int CMDISpView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	m_wndSplitter.CreateStatic(this, 1, 2);
	CCreateContext *pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;
	lpCreateStruct->style |= WS_OVERLAPPED;
	
	m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTestView), CSize(0,0), pContext);
	m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView),  CSize(0,0), pContext);

	return 0;
}

void CMDISpView::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	m_wndSplitter.MoveWindow(0, 0, cx, cy);

	m_wndSplitter.SetColumnInfo(0, cx/3, 0);
	
	m_wndSplitter.RecalcLayout();  
}
//////////////////////////////////////////////////////////////////////
void CMDISpView::OnInitialUpdate() 
{
	if(m_bInitialized)
		return;
	m_bInitialized = true;
	
	for(int i = 0; i < 2; i++)
	{
		CView* pView = (CView*)m_wndSplitter.GetPane(0, i);
		pView->OnInitialUpdate();
	}
}

⌨️ 快捷键说明

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