📄 imageotherspreaddoc.cpp
字号:
// ImageOtherSpreadDoc.cpp : implementation of the CImageOtherSpreadDoc class
//
#include "stdafx.h"
#include "ImageOtherSpread.h"
#include "ImageOtherSpreadDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CImageOtherSpreadDoc
IMPLEMENT_DYNCREATE(CImageOtherSpreadDoc, CDocument)
BEGIN_MESSAGE_MAP(CImageOtherSpreadDoc, CDocument)
//{{AFX_MSG_MAP(CImageOtherSpreadDoc)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CImageOtherSpreadDoc construction/destruction
CImageOtherSpreadDoc::CImageOtherSpreadDoc()
{
// TODO: add one-time construction code here
m_pDib = NULL;
}
CImageOtherSpreadDoc::~CImageOtherSpreadDoc()
{
if(m_pDib) delete m_pDib;
}
BOOL CImageOtherSpreadDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CImageOtherSpreadDoc serialization
void CImageOtherSpreadDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CImageOtherSpreadDoc diagnostics
#ifdef _DEBUG
void CImageOtherSpreadDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CImageOtherSpreadDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CImageOtherSpreadDoc commands
void CImageOtherSpreadDoc::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 CImageOtherSpreadDoc::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 + -