静态切分窗口

代码
// MainFrm.cpp : implementation of the CMainFrame class
//

#include
"stdafx.h"
#include
"ex_5.h"
#include
"Ex_5WndView1.h"
#include
"Ex_5WndView2.h"

#include
"MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
// TODO: add member initialization code here

}

CMainFrame::
~CMainFrame()
{
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT
& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

return TRUE;
}

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext
* pContext)
{
CRect cr;
GetClientRect(
&cr);
CSize paneSize(cr.Width()
/3,cr.Height()/3);
m_Splitter.CreateStatic(
this,2,1);
// m_Splitter.CreateView(0,0,RUNTIME_CLASS(CEx_5View),paneSize,pContext);
m_Splitter.CreateView(0,0,RUNTIME_CLASS(CEx_5WndView1),paneSize,pContext);
m_Splitter.CreateView(
1,0,RUNTIME_CLASS(CEx_5WndView2),paneSize,pContext);

return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

 

执行结果:

 

posted on 2010-04-12 19:18  不知道  阅读(268)  评论(0编辑  收藏  举报

导航