rectdoc.cpp
来自「一些VC++的经典实例」· C++ 代码 · 共 91 行
CPP
91 行
// RectDoc.cpp : implementation file
//
#include "stdafx.h"
#include "ex22.h"
#include "RectDoc.h"
#include "rectdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRectDoc
IMPLEMENT_DYNCREATE(CRectDoc, CDocument)
CRectDoc::CRectDoc()
{
m_length=200;
m_width=100;
}
BOOL CRectDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
return TRUE;
}
CRectDoc::~CRectDoc()
{
}
BEGIN_MESSAGE_MAP(CRectDoc, CDocument)
//{{AFX_MSG_MAP(CRectDoc)
ON_COMMAND(IC_INPUT_SIDES, OnInputSides)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRectDoc diagnostics
#ifdef _DEBUG
void CRectDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CRectDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRectDoc serialization
void CRectDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
ar<<m_length<<m_width;
}
else
{
// TODO: add loading code here
ar>>m_length>>m_width;
}
}
/////////////////////////////////////////////////////////////////////////////
// CRectDoc commands
void CRectDoc::OnInputSides()
{
// TODO: Add your command handler code here
m_RectDlg.m_length=m_length;
m_RectDlg.m_width=m_width;
if(m_RectDlg.DoModal()==IDOK)
{
m_length=m_RectDlg.m_length;
m_width=m_RectDlg.m_width;
}
UpdateAllViews(NULL);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?