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

📄 printpatdoc.cpp

📁 模式识别中经典试验
💻 CPP
字号:
// PrintPatDoc.cpp : implementation of the CPrintPatDoc class
//

#include "stdafx.h"
#include "PrintPat.h"

#include "PrintPatDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPrintPatDoc

IMPLEMENT_DYNCREATE(CPrintPatDoc, CDocument)

BEGIN_MESSAGE_MAP(CPrintPatDoc, CDocument)
	//{{AFX_MSG_MAP(CPrintPatDoc)
	ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPrintPatDoc construction/destruction

CPrintPatDoc::CPrintPatDoc()
{
	// TODO: add one-time construction code here
	m_pDib = NULL;
}

CPrintPatDoc::~CPrintPatDoc()
{
}

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

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CPrintPatDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CPrintPatDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CPrintPatDoc commands

void CPrintPatDoc::OnFileOpen() 
{
	// TODO: Add your command handler code here
	CFileDialog fileOpenDlg(TRUE,"bmp","*.bmp",NULL,"Bitmap Files(*.bmp)",NULL);
	
	UINT Respond = fileOpenDlg.DoModal();

	if(Respond == IDOK)
	{
		CString fileName = fileOpenDlg.GetPathName();
		m_pDib = new CDib(fileName);
		
		if(m_pDib->IsValid())
			SetTitle(fileName);
		else 
			DeleteContents();
	}
	UpdateAllViews(0);
}

void CPrintPatDoc::DeleteContents() 
{
	// TODO: Add your specialized code here and/or call the base class
	if(m_pDib)
	{
		delete m_pDib;
		m_pDib = NULL;
	}
	CDocument::DeleteContents();
}

CDib * CPrintPatDoc::GetDibPoint()
{
	return m_pDib;
}

⌨️ 快捷键说明

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