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

📄 ch14demo5view.cpp

📁 零基础学Visual.C....教案PPT.随书光盘-452M.zip
💻 CPP
字号:
// Ch14Demo5View.cpp : implementation of the CCh14Demo5View class
//

#include "stdafx.h"
#include "Ch14Demo5.h"
#include "mainfrm.h"
#include "Ch14Demo5Doc.h"
#include "Ch14Demo5View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCh14Demo5View

IMPLEMENT_DYNCREATE(CCh14Demo5View, CHtmlView)

BEGIN_MESSAGE_MAP(CCh14Demo5View, CHtmlView)
	//{{AFX_MSG_MAP(CCh14Demo5View)
	ON_BN_CLICKED(IDC_GO, OnGo)
	ON_BN_CLICKED(IDC_REFLESH, OnReflesh)
	ON_BN_CLICKED(IDC_STOP, OnStop)
	ON_BN_CLICKED(IDC_BACK, OnBack)
	ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeCombo1)
	ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCh14Demo5View construction/destruction

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

}

CCh14Demo5View::~CCh14Demo5View()
{
}

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

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CCh14Demo5View drawing

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

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

/////////////////////////////////////////////////////////////////////////////
// CCh14Demo5View printing


/////////////////////////////////////////////////////////////////////////////
// CCh14Demo5View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CCh14Demo5View message handlers

void CCh14Demo5View::OnGo() 
{
	// TODO: Add your control notification handler code here
	CClientDC dc(this);
	dc.TextOut(4,18,CString("正在连接<")+m_site+">...");					//显示信息
	Navigate2(m_site);								//打开网页
	Invalidate(FALSE);										//更新视图
	CMainFrame *pframe=(CMainFrame *)AfxGetMainWnd();			//获取主框架指针
	CDialogBar *pbar=pframe->GetDialogBar();						//获取对话条指针
	CComboBox *pcombobox;
	pcombobox=(CComboBox *)pbar->GetDlgItem(IDC_COMBO1);
	pcombobox->AddString(m_site);									//添加列表框	
}

void CCh14Demo5View::OnReflesh() 
{
	// TODO: Add your control notification handler code here
	Refresh();												//刷新
	Invalidate(FALSE);										//更新视图
}

void CCh14Demo5View::OnStop() 
{
	// TODO: Add your control notification handler code here
	Stop();												//停止下载网页
	Invalidate(FALSE);										//更新视图

}

void CCh14Demo5View::OnBack() 
{
	// TODO: Add your control notification handler code here
	GoBack();
	Invalidate(FALSE);										//更新视图
}

void CCh14Demo5View::OnEditchangeCombo1() 
{
	// TODO: Add your control notification handler code here
	CMainFrame *pframe=(CMainFrame *)AfxGetMainWnd();			//获取主框架指针
	CDialogBar *pbar=pframe->GetDialogBar();						//获取对话条指针
	pbar->GetDlgItemText(IDC_COMBO1,m_site);					//获取组合框中的数据	
}

void CCh14Demo5View::OnSelchangeCombo1() 
{
	// TODO: Add your control notification handler code here
	CMainFrame *pframe=(CMainFrame *)AfxGetMainWnd();			//获取主框架指针
	CDialogBar *pbar=pframe->GetDialogBar();						//获取对话条指针
	pbar->GetDlgItemText(IDC_COMBO1,m_site);					//获取组合框中的数据
	OnGo();												//执行打开网页		
}

⌨️ 快捷键说明

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