📄 mybrowserview.cpp
字号:
// MyBrowserView.cpp : implementation of the CMyBrowserView class
//
#include "stdafx.h"
#include "MyBrowser.h"
#include "MainFrm.h"
#include "MyBrowserDoc.h"
#include "MyBrowserView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyBrowserView
IMPLEMENT_DYNCREATE(CMyBrowserView, CHtmlView)
BEGIN_MESSAGE_MAP(CMyBrowserView, CHtmlView)
//{{AFX_MSG_MAP(CMyBrowserView)
ON_COMMAND(ID_GOBACK, OnGoback)
ON_COMMAND(ID_GOFOWARD, OnGofoward)
ON_COMMAND(ID_HOMEPAGE, OnHomepage)
ON_COMMAND(ID_SEARCH, OnSearch)
ON_COMMAND(ID_STOP, OnStop)
ON_COMMAND(ID_UPDATE, OnUpdate)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyBrowserView construction/destruction
CMyBrowserView::CMyBrowserView()
{
// TODO: add construction code here
}
CMyBrowserView::~CMyBrowserView()
{
}
BOOL CMyBrowserView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CHtmlView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMyBrowserView drawing
void CMyBrowserView::OnDraw(CDC* pDC)
{
CMyBrowserDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CMyBrowserView::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("www.microsoft.com/visualc"),NULL,NULL);
}
/////////////////////////////////////////////////////////////////////////////
// CMyBrowserView printing
/////////////////////////////////////////////////////////////////////////////
// CMyBrowserView diagnostics
#ifdef _DEBUG
void CMyBrowserView::AssertValid() const
{
CHtmlView::AssertValid();
}
void CMyBrowserView::Dump(CDumpContext& dc) const
{
CHtmlView::Dump(dc);
}
CMyBrowserDoc* CMyBrowserView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyBrowserDoc)));
return (CMyBrowserDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyBrowserView message handlers
void CMyBrowserView::OnGoback()
{
// TODO: Add your command handler code here
GoBack();
}
void CMyBrowserView::OnGofoward()
{
// TODO: Add your command handler code here
GoForward();
}
void CMyBrowserView::OnHomepage()
{
// TODO: Add your command handler code here
GoHome();
}
void CMyBrowserView::OnSearch()
{
// TODO: Add your command handler code here
GoSearch();
}
void CMyBrowserView::OnStop()
{
// TODO: Add your command handler code here
Stop();
}
void CMyBrowserView::OnUpdate()
{
// TODO: Add your command handler code here
Refresh();
}
void CMyBrowserView::OnDocumentComplete(LPCTSTR lpszURL)
{
// TODO: Add your specialized code here and/or call the base class
((CMainFrame*)GetParentFrame())->SetPage(lpszURL);
// CHtmlView::OnDocumentComplete(lpszURL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -