📄 imgview.cpp
字号:
////////////////////////////////////////////////////////////////
// MSDN Magazine -- October 2001
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// Compiles with Visual C++ 6.0 for Windows 98 and probably Windows 2000 too.
// Set tabsize = 3 in your editor.
//
#include "StdAfx.h"
#include "TraceWin.h"
#include "resource.h"
#include "MainFrm.h"
#include "View.h"
#include "StatLink.h"
#include "PictCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////
// Standard application class
//
class CMyApp : public CWinApp {
public:
DECLARE_DYNAMIC(CMyApp)
virtual BOOL InitInstance();
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnAppAbout();
};
BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
IMPLEMENT_DYNAMIC(CMyApp, CWinApp)
CMyApp theApp;
BOOL CMyApp::InitInstance()
{
SetRegistryKey("MSDN Magazine"); // Save settings in registry, not INI file
LoadStdProfileSettings(8); // Standard file options (8 MRU files)
// initialize coolbars. Note: assumes you have
// comctl32.dll version 470 or greater
//
INITCOMMONCONTROLSEX sex;
sex.dwSize = sizeof(INITCOMMONCONTROLSEX);
sex.dwICC = ICC_COOL_CLASSES;
InitCommonControlsEx(&sex);
// Create standard doc/frame/view
AddDocTemplate(new CSingleDocTemplate(IDR_MAINFRAME,
RUNTIME_CLASS(CPictureDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CPictureView)));
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
return ProcessShellCommand(cmdInfo);
}
//////////////////
// Custom about dialog uses CStaticLink for hyperlinks.
// * for text control, URL is specified as text in dialog editor
// * for icon control, URL is specified by setting m_iconLink.m_link
//
class CAboutDialog : public CDialog {
protected:
// static controls with hyperlinks
CStaticLink m_wndLink1;
CStaticLink m_wndLink2;
CStaticLink m_wndLink3;
CPictureCtrl m_wndPict;
public:
CAboutDialog() : CDialog(IDD_ABOUTBOX) { }
virtual BOOL OnInitDialog();
};
/////////////////
// Initialize dialog: subclass static text/icon controls
//
BOOL CAboutDialog::OnInitDialog()
{
// subclass static controls. URL is static text or 3rd arg
m_wndLink1.SubclassDlgItem(IDC_STATICURLPD,this);
m_wndLink2.SubclassDlgItem(IDC_STATICURLMSDN,this);
m_wndPict.SubclassDlgItem(IDC_IMAGECATFLY,this);
return CDialog::OnInitDialog();
}
//////////////////
// Handle Help | About : run the About dialog
//
void CMyApp::OnAppAbout()
{
static CAboutDialog dlg;
dlg.DoModal();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -