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

📄 childfrm.cpp

📁 splitter source code to see see may be useful
💻 CPP
字号:
// ChildFrm.cpp : implementation of the CChildFrame class
//

#include "stdafx.h"
#include "AutomaticSplitter.h"
#include "AutomaticSplitterView.h"

#include "ChildFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CChildFrame

IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)

BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
	//{{AFX_MSG_MAP(CChildFrame)
	ON_WM_TIMER()
	ON_COMMAND(ID_WINDOW_AUTOMATICSPLIT, OnWindowAutomaticsplit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction

CChildFrame::CChildFrame()
{
	// TODO: add member initialization code here
	
}

CChildFrame::~CChildFrame()
{
}

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

	if( !CMDIChildWnd::PreCreateWindow(cs) )
		return FALSE;

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics

#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
	CMDIChildWnd::AssertValid();
}

void CChildFrame::Dump(CDumpContext& dc) const
{
	CMDIChildWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers

//==================================================================================
// Function name	: CChildFrame::OnCreateClient
// Written by	    : 
// Description	    : 
// Return type		: BOOL 
//==================================================================================
// Argument         : LPCREATESTRUCT lpcs
// Argument         : CCreateContext* pContext
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	return m_wndSplitter.Create( this,
		2, 2,                 // TODO: adjust the number of rows, columns
		CSize( 10, 10 ),      // TODO: adjust the minimum pane size
		pContext ,WS_CHILD | WS_VISIBLE  | SPLS_DYNAMIC_SPLIT);
}



void CChildFrame::AutomaticSplit()
{
	KillTimer(1);  // Destroy the old timer
	SetTimer(1, 10 , NULL); // Creates a new timer (index = 1 ; time = 10ms)
	m_wndSplitter.DoAutomaticSplit();	
}

void CChildFrame::OnTimer(UINT nIDEvent) 
{
	if ( m_wndSplitter.m_bSplittingDone )
	{
		KillTimer(1);
		int nbRow = m_wndSplitter.GetRowCount();
		int nbCol = m_wndSplitter.GetColumnCount();
		for ( int r = 0 ; r < nbRow ; r++ )
		{
			for ( int c = 0 ; c < nbCol ; c++ )
			{
				CAutomaticSplitterView* theView = (CAutomaticSplitterView*)m_wndSplitter.GetPane(r,c);
				if ( r==0 && c==0) //top-left
					theView->DoSomething(RGB(255,0,0));
				else if ( r==0 && c==1) //top-right
					theView->DoSomething(RGB(0,255,0));
				else if ( r==1 && c==0) //bottom-left
					theView->DoSomething(RGB(0,0,255));
				else if ( r==1 && c==1)//bottom-right
					theView->DoSomething(RGB(255,255,0));
			}
		}
	}
}

void CChildFrame::OnWindowAutomaticsplit() 
{
	AutomaticSplit();
}

⌨️ 快捷键说明

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