myhtml~1.cpp

来自「visual c++ 时尚编程百例 全部源代码」· C++ 代码 · 共 131 行

CPP
131 行
字号
// MyHtmlView.cpp : implementation of the CMyHtmlView class
//

#include "stdafx.h"
#include "MyHtml.h"
#include "MainFrm.h"

#include "MyHtmlDoc.h"
#include "MyHtmlView.h"
#include"MyDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyHtmlView

IMPLEMENT_DYNCREATE(CMyHtmlView, CHtmlView)

BEGIN_MESSAGE_MAP(CMyHtmlView, CHtmlView)
	//{{AFX_MSG_MAP(CMyHtmlView)
	ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeCombo1)
	ON_CBN_SELENDCANCEL(IDC_COMBO1, OnSelendcancelCombo1)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyHtmlView construction/destruction

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

}

CMyHtmlView::~CMyHtmlView()
{
}

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

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMyHtmlView drawing

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyHtmlView printing


/////////////////////////////////////////////////////////////////////////////
// CMyHtmlView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyHtmlView message handlers

void CMyHtmlView::OnEditchangeCombo1() 
{
	CMainFrame *pw=(CMainFrame*)AfxGetMainWnd();
	CDialogBar *pb=pw->GetDialogBar();
	pb->GetDlgItemText(IDC_COMBO1,site);

	// TODO: Add your control notification handler code here
	
}

void CMyHtmlView::OnSelendcancelCombo1() 
{
	CMainFrame*pw=(CMainFrame*)AfxGetMainWnd();
	CDialogBar*pb=pw->GetDialogBar();
	pb->GetDlgItemText(IDC_COMBO1,site);
	OnButton1();
	// TODO: Add your control notification handler code here
	
}

void CMyHtmlView::OnButton1() 
{
	CClientDC dc(this);
	dc.TextOut(2,8,CString("Linking to<")+site+">...");
	Navigate2(site,NULL,NULL);
	Invalidate(FALSE);

	// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

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