splitframe.cpp

来自「< MFC经典问答>>是微软类库经常遇到的问题」· C++ 代码 · 共 75 行

CPP
75
字号
// SplitFrame.cpp : implementation file
//

#include "stdafx.h"
#include "PropertySheetInSplitter.h"
#include "SplitFrame.h"

#include "DrawDoc.h"
#include "DrawView.h"
#include "PSheetFormView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSplitFrame

IMPLEMENT_DYNCREATE(CSplitFrame, CMDIChildWnd)

CSplitFrame::CSplitFrame()
{
}

CSplitFrame::~CSplitFrame()
{
}

BOOL CSplitFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
	CRect rect;
	GetClientRect( &rect );
	CSize size = rect.Size();
	size.cy /= 2;		// Initial row size

	// 1 - Create static splitter
	if( !m_wndSplitter.CreateStatic( this, 2, 1 ) )	// 2 rows, 1 col
	{
		TRACE0( "Failed to create static splitter\n" );
		return FALSE;
	}

	// 2 - Create top view
	if( !m_wndSplitter.CreateView( 0, 0,			// row 0, col 0
							RUNTIME_CLASS( CDrawView ), 
							size, pContext ) )
	{
		TRACE0( "Failed to create top view\n" );
		return FALSE;
	}

	// 3 - Create bottom view
	if( !m_wndSplitter.CreateView( 1, 0,			// row 1, col 0
							RUNTIME_CLASS( CPSheetFormView ), 
							size, pContext ) )
	{
		TRACE0( "Failed to create bottom view\n" );
		return FALSE;
	}

	return TRUE;
}


BEGIN_MESSAGE_MAP(CSplitFrame, CMDIChildWnd)
	//{{AFX_MSG_MAP(CSplitFrame)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSplitFrame message handlers

⌨️ 快捷键说明

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