www.pudn.com > PropertyPage.zip > PropertyPageView.cpp


// PropertyPageView.cpp : implementation of the CPropertyPageView class 
// 
 
#include "stdafx.h" 
#include "PropertyPage.h" 
 
#include "PropertyPageDoc.h" 
#include "PropertyPageView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CPropertyPageView 
 
IMPLEMENT_DYNCREATE(CPropertyPageView, CView) 
 
BEGIN_MESSAGE_MAP(CPropertyPageView, CView) 
	//{{AFX_MSG_MAP(CPropertyPageView) 
	ON_COMMAND(ID_SHEET, OnSheet) 
	//}}AFX_MSG_MAP 
	// Standard printing commands 
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CPropertyPageView construction/destruction 
 
CPropertyPageView::CPropertyPageView() 
{ 
	// TODO: add construction code here 
 
} 
 
CPropertyPageView::~CPropertyPageView() 
{ 
} 
 
BOOL CPropertyPageView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	return CView::PreCreateWindow(cs); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CPropertyPageView drawing 
 
void CPropertyPageView::OnDraw(CDC* pDC) 
{ 
	CPropertyPageDoc* pDoc = GetDocument(); 
	ASSERT_VALID(pDoc); 
	// TODO: add draw code for native data here 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CPropertyPageView printing 
 
BOOL CPropertyPageView::OnPreparePrinting(CPrintInfo* pInfo) 
{ 
	// default preparation 
	return DoPreparePrinting(pInfo); 
} 
 
void CPropertyPageView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add extra initialization before printing 
} 
 
void CPropertyPageView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add cleanup after printing 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CPropertyPageView diagnostics 
 
#ifdef _DEBUG 
void CPropertyPageView::AssertValid() const 
{ 
	CView::AssertValid(); 
} 
 
void CPropertyPageView::Dump(CDumpContext& dc) const 
{ 
	CView::Dump(dc); 
} 
 
CPropertyPageDoc* CPropertyPageView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPropertyPageDoc))); 
	return (CPropertyPageDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CPropertyPageView message handlers 
 
void CPropertyPageView::OnSheet()  
{ 
// TODO: Add your command handler code here 
	//创建属性表对象 
	CSheet sheet("PropertySheet",this,0); 
	//初始化属性页中的控件变量 
	sheet.m_TextPage.m_text=m_text; 
	sheet.m_TextPage.m_x=m_x; 
	sheet.m_TextPage.m_y=m_y; 
	sheet.m_PropPage.m_ncolor=m_ncolor; 
	sheet.m_PropPage.m_nsize=m_nsize; 
	//显示属性表 
	if(sheet.DoModal()==IDOK) 
	{ 
		//将属性表中的信息传递到应用程序中 
		m_text=sheet.m_TextPage.m_text; 
		m_x=sheet.m_TextPage.m_x; 
		m_y=sheet.m_TextPage.m_y; 
		m_ncolor=sheet.m_PropPage.m_ncolor; 
		m_nsize=sheet.m_PropPage.m_nsize; 
		//重绘视图区 
		Invalidate(); 
	}	 
}