formview2view.cpp

来自「当我们使用formview时」· C++ 代码 · 共 116 行

CPP
116
字号
// formview2View.cpp : implementation of the CFormview2View class
//

#include "stdafx.h"
#include "formview2.h"

#include "formview2Doc.h"
#include "formview2View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFormview2View

IMPLEMENT_DYNCREATE(CFormview2View, CResizableFormView)

BEGIN_MESSAGE_MAP(CFormview2View, CResizableFormView)
	//{{AFX_MSG_MAP(CFormview2View)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CFormview2View construction/destruction

CFormview2View::CFormview2View()
	: CResizableFormView(CFormview2View::IDD)
{
	//{{AFX_DATA_INIT(CFormview2View)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CFormview2View::~CFormview2View()
{
}

void CFormview2View::DoDataExchange(CDataExchange* pDX)
{
	CResizableFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFormview2View)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

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

	return CResizableFormView::PreCreateWindow(cs);
}

void CFormview2View::OnInitialUpdate()
{
	// jms - 11/28/00 - new code starts
	// We do this here because we need to get the *original* size of the 
	// controls *before* the dialog is sized the first time.  I don't know 
	// what will happen if we do it after, but I didn't want to find out.
	//
	// Since we do this here, I decided to pass the parameters needed by 
	// the AddAnchor() function to elminate the need to call AddAnchor 
	// from this function 9after the view had been resized).
	AddResizedControl(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
	AddResizedControl(IDC_GROUP1, TOP_LEFT, BOTTOM_LEFT);
	// jms - 11/28/00 - new code stops

	CResizableFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

	// Normally, we would put the calls to AddAnchor AFTER we call 
	// ResizeParentToFit().
	//AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
	//AddAnchor(IDC_GROUP1, TOP_LEFT, BOTTOM_LEFT);

	// jms - 11/28/00 - new code starts
	// Now anchor the controls we specified earler in this function. We call 
	// this function because it cycles thru the list of controls that are to 
	// be resized. This prevents us from having to call AddAnchor (lots of 
	// redundant typing at this point).
	AnchorControls();

}

/////////////////////////////////////////////////////////////////////////////
// CFormview2View diagnostics

#ifdef _DEBUG
void CFormview2View::AssertValid() const
{
	CResizableFormView::AssertValid();
}

void CFormview2View::Dump(CDumpContext& dc) const
{
	CResizableFormView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CFormview2View message handlers

⌨️ 快捷键说明

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