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

📄 sobelkirschdoc.cpp

📁 visual c++数字图像与图形处理中的光盘内容
💻 CPP
字号:
// SobelKirschDoc.cpp : implementation of the CSobelKirschDoc class
//

#include "stdafx.h"
#include "SobelKirsch.h"

#include "SobelKirschDoc.h"

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


/////////////////////////////////////////////////////////////////////////////
// CSobelKirschDoc

IMPLEMENT_DYNCREATE(CSobelKirschDoc, CDocument)

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

/////////////////////////////////////////////////////////////////////////////
// CSobelKirschDoc construction/destruction

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

CSobelKirschDoc::~CSobelKirschDoc()
{
	if(m_pDib) delete m_pDib;
}

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

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CSobelKirschDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CSobelKirschDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CSobelKirschDoc commands

void CSobelKirschDoc::OnFileOpen() 
{
	// TODO: Add your command handler code here
	CFileDialog fileOpenDlg(TRUE,"bmp","*.bmp",NULL,"Bitmap Files(*.bmp)",NULL);
	int nRespond = fileOpenDlg.DoModal();
	if(nRespond == IDOK)
	{
		CString filePath = fileOpenDlg.GetPathName();
		m_pDib = new CDib(filePath);
		if(m_pDib->IsValid())
			SetTitle(filePath);
		else	
			DeleteContents();
	}
	UpdateAllViews(0);	
}

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

⌨️ 快捷键说明

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