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

📄 sdi_projectdoc.cpp

📁 用MFC开发的SDI程序
💻 CPP
字号:
// SDI_projectDoc.cpp : implementation of the CSDI_projectDoc class
//

#include "stdafx.h"
#include "SDI_project.h"

#include "SDI_projectDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSDI_projectDoc

IMPLEMENT_DYNCREATE(CSDI_projectDoc, CDocument)

BEGIN_MESSAGE_MAP(CSDI_projectDoc, CDocument)
	//{{AFX_MSG_MAP(CSDI_projectDoc)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CSDI_projectDoc construction/destruction

CSDI_projectDoc::CSDI_projectDoc()
{
	// TODO: add one-time construction code here
	this->m_size   = cvSize(0, 0);
	this->m_opened = false ;
	this->m_image  = NULL;
}

CSDI_projectDoc::~CSDI_projectDoc()
{
	if (this->m_image) cvReleaseImage(&this->m_image);
}

BOOL CSDI_projectDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CSDI_projectDoc serialization

void CSDI_projectDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CSDI_projectDoc diagnostics

#ifdef _DEBUG
void CSDI_projectDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CSDI_projectDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CSDI_projectDoc commands

BOOL CSDI_projectDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	
	// TODO: Add your specialized creation code here
	this->m_image = cvLoadImage(lpszPathName);
	if (m_image) {
		this->m_size   = cvGetSize (this->m_image);
		this->m_opened = true;
	};
	
	return TRUE;
}

BOOL CSDI_projectDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
	// TODO: Add your specialized code here and/or call the base class
	cvSaveImage(lpszPathName, this->m_image);

	return CDocument::OnSaveDocument(lpszPathName);
}

⌨️ 快捷键说明

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