📄 showgifdoc.cpp
字号:
// ShowGifDoc.cpp : implementation of the CShowGifDoc class
//
#include "stdafx.h"
#include "ShowGif.h"
#include "ShowGifDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShowGifDoc
IMPLEMENT_DYNCREATE(CShowGifDoc, CDocument)
BEGIN_MESSAGE_MAP(CShowGifDoc, CDocument)
//{{AFX_MSG_MAP(CShowGifDoc)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShowGifDoc construction/destruction
CShowGifDoc::CShowGifDoc()
{
// TODO: add one-time construction code here
}
CShowGifDoc::~CShowGifDoc()
{
}
BOOL CShowGifDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CShowGifDoc serialization
void CShowGifDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CShowGifDoc diagnostics
#ifdef _DEBUG
void CShowGifDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CShowGifDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CShowGifDoc commands
void CShowGifDoc::OnFileOpen()
{
CString FileName(_T(""));
CFileDialog FileDlg(TRUE,NULL,NULL,OFN_HIDEREADONLY,TEXT("GIF Files(*.GIF)|*.GIF||"));
if(FileDlg.DoModal()==IDOK)
{
FileName=FileDlg.GetPathName();
}
if(FileName!="")
{
BOOL r=m_Image.Load(FileName);
if (!r) m_Image.Empty();
UpdateAllViews(NULL);
}
}
CSize CShowGifDoc::GetSize()
{
CSize size;
size.cx=m_Image.Width();
size.cy=m_Image.Height();
return size;
}
void CShowGifDoc::UpdateContents()
{
if (m_Image.UpdateDynImage())
UpdateAllViews(NULL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -