⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program78view.cpp

📁 该程序设计了一个浏览器。它可以用作普通浏览网页的浏览器
💻 CPP
字号:
// program78View.cpp : implementation of the CProgram78View class
//

#include "stdafx.h"
#include "program78.h"

#include "program78Doc.h"
#include "program78View.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CProgram78View

IMPLEMENT_DYNCREATE(CProgram78View, CHtmlView)

BEGIN_MESSAGE_MAP(CProgram78View, CHtmlView)
	//{{AFX_MSG_MAP(CProgram78View)
	ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
	ON_BN_CLICKED(IDC_BUTGO, OnButgo)
	ON_BN_CLICKED(IDC_BUTPRE, OnButpre)
	ON_BN_CLICKED(IDC_BUTNEXT, OnButnext)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProgram78View construction/destruction

CProgram78View::CProgram78View()
{
	// TODO: add construction code here

}

CProgram78View::~CProgram78View()
{
}

BOOL CProgram78View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CProgram78View drawing

void CProgram78View::OnDraw(CDC* pDC)
{
	CProgram78Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

void CProgram78View::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);
}

/////////////////////////////////////////////////////////////////////////////
// CProgram78View printing


/////////////////////////////////////////////////////////////////////////////
// CProgram78View diagnostics

#ifdef _DEBUG
void CProgram78View::AssertValid() const
{
	CHtmlView::AssertValid();
}

void CProgram78View::Dump(CDumpContext& dc) const
{
	CHtmlView::Dump(dc);
}

CProgram78Doc* CProgram78View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CProgram78Doc)));
	return (CProgram78Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CProgram78View message handlers

void CProgram78View::OnFileOpen() 
{
	CFileDialog dlg(TRUE,_T("html"),_T("*.html"),OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,__T("网页(*.html)|*.html|所有文件(*.*)|*.*"));
	if(IDOK==dlg.DoModal())
	{	
		Navigate2(dlg.GetPathName(),NULL,NULL);
	}	
}

void CProgram78View::OnButgo() 
{
	CMainFrame * pWnd=(CMainFrame *)AfxGetMainWnd();	//取得框架指针
	CDialogBar * pDlg=&(pWnd->m_wndDlgBar);		//取得工具栏对话框指针
	CString strWWW;
	pDlg->GetDlgItemText(IDC_CBURL,strWWW);		//取得组合框文本
	Navigate2(strWWW,NULL,NULL);	//打开文件
}

void CProgram78View::OnButpre() 
{
	CHtmlView::GoBack();	
}

void CProgram78View::OnButnext() 
{
	CHtmlView::GoForward();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -