📄 htmviewerview.cpp
字号:
// HTMViewerView.cpp : implementation of the CHTMViewerView class
//
#include "stdafx.h"
#include "HTMViewer.h"
#include "HTMViewerDoc.h"
#include "HTMViewerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CHTMViewerView
IMPLEMENT_DYNCREATE(CHTMViewerView, CHtmlView)
BEGIN_MESSAGE_MAP(CHTMViewerView, CHtmlView)
//{{AFX_MSG_MAP(CHTMViewerView)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHTMViewerView construction/destruction
CHTMViewerView::CHTMViewerView()
{
// TODO: add construction code here
}
CHTMViewerView::~CHTMViewerView()
{
}
BOOL CHTMViewerView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CHtmlView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CHTMViewerView drawing
void CHTMViewerView::OnDraw(CDC* pDC)
{
CHTMViewerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CHTMViewerView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
// TODO: This code navigates to a popular spot on the web.
// change the code to go where you'd like.
// Navigate2(_T("http://www.microsoft.com/visualc/"),NULL,NULL);
}
/////////////////////////////////////////////////////////////////////////////
// CHTMViewerView diagnostics
#ifdef _DEBUG
void CHTMViewerView::AssertValid() const
{
CHtmlView::AssertValid();
}
void CHTMViewerView::Dump(CDumpContext& dc) const
{
CHtmlView::Dump(dc);
}
CHTMViewerDoc* CHTMViewerView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHTMViewerDoc)));
return (CHTMViewerDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CHTMViewerView message handlers
void CHTMViewerView::OnFileOpen()
{
// TODO: Add your command handler code here
CFileDialog dlgFile(TRUE);
dlgFile.m_ofn.lpstrFilter = _T("HTM files\0*.htm;*.html\0");
dlgFile.m_ofn.nFilterIndex = 1; dlgFile.m_ofn.hwndOwner = AfxGetMainWnd()->GetSafeHwnd();
if ( dlgFile.DoModal() == IDOK)
Navigate2(dlgFile.GetPathName(),NULL,NULL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -