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

📄 htmlsampledlg.cpp

📁 vc编写的方便解析HTML文件的代码, 可以方便的修改里面的元素
💻 CPP
字号:
// HTMLSample.cpp : implementation file
//

#include "stdafx.h"
#include "Sample.h"
#include "HTMLSampleDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHTMLSampleDlg dialog


CHTMLSampleDlg::CHTMLSampleDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CHTMLSampleDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CHTMLSampleDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CHTMLSampleDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CHTMLSampleDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CHTMLSampleDlg, CDialog)
	//{{AFX_MSG_MAP(CHTMLSampleDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHTMLSampleDlg message handlers

BOOL CHTMLSampleDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	this->m_cHTML.CreateFromStatic(IDC_STAT_HTML,this);

	this->m_iCounter = 0;

	OnButton1();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CHTMLSampleDlg::OnButton1() 
{
	CString csHTML = "";

	m_iCounter++;

	// Preparing the HTML page to be shown...
	csHTML.Format("<html><body bgcolor=\"7AA1E6\" leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" oncontextmenu=\"return false\"><table width=\"100%%\" bgcolor=\"7AA1E6\" align=\"left\" cellspacing=\"6\"><tr><td bgcolor=\"D6DFF7\" bordercolor=\"#FFFFFF\"><table width=\"100%%\"><tr><td bgcolor=\"#FFFFFF\"><img src=\"rang.png\" width=\"16\" height=\"16\"> Actual value</td></tr><tr><td><font size=\"2\">Now the value is: <b>%i</b>.</font></td></tr></table></td></tr></table></body></html>",
								m_iCounter);

	this->m_cHTML.SetNewHTMLContent(csHTML,true);
}

⌨️ 快捷键说明

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