📄 splitframe2.cpp
字号:
// SplitFrame2.cpp : implementation file
//
#include "stdafx.h"
#include "MultiSplit.h"
#include "SplitFrame2.h"
#include "DrawDoc.h"
#include "DrawView.h"
#include "DrawFormView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSplitFrame2
IMPLEMENT_DYNCREATE(CSplitFrame2, CMDIChildWnd)
CSplitFrame2::CSplitFrame2()
{
}
CSplitFrame2::~CSplitFrame2()
{
}
BOOL CSplitFrame2::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
CRect rect;
GetClientRect( &rect );
CSize size = rect.Size();
size.cx /= 2; // Initial column size
size.cy /= 2; // Initial row size
// 1 - Create first static splitter
if( !m_wndSplitter1.CreateStatic( this, 2, 1 ) ) // 2 rows, 1 col
{
TRACE0( "Failed to create first static splitter\n" );
return FALSE;
}
// 2 - Create top row view
if( !m_wndSplitter1.CreateView( 0, 0, // row 0, col 0
RUNTIME_CLASS( CDrawView ),
size, pContext ) )
{
TRACE0( "Failed to create top view\n" );
return FALSE;
}
// 3 - Create nested static splitter
if( !m_wndSplitter2.CreateStatic( &m_wndSplitter1, 1, 2, // 1 row, 2 cols
WS_CHILD | WS_VISIBLE,
m_wndSplitter1.IdFromRowCol( 1, 0 ) ) )
{
TRACE0( "Failed to create nested static splitter\n" );
return FALSE;
}
// 4 - Create bottom-left view
if( !m_wndSplitter2.CreateView( 0, 0, // row 0, col 0
RUNTIME_CLASS( CDrawFormView ),
size, pContext ) )
{
TRACE0( "Failed to create bottom-left view\n" );
return FALSE;
}
// 5 - Create bottom-right view
if( !m_wndSplitter2.CreateView( 0, 1, // row 0, col 1
RUNTIME_CLASS( CDrawView ),
size, pContext ) )
{
TRACE0( "Failed to create bottom-right view\n" );
return FALSE;
}
return TRUE;
}
BEGIN_MESSAGE_MAP(CSplitFrame2, CMDIChildWnd)
//{{AFX_MSG_MAP(CSplitFrame2)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSplitFrame2 message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -