📄 sthtmldialog.h
字号:
/////////////////////////////////////////////////////////////////////////////
// File name: STHtmlDialog.h
// Author: Vassili Philippov (vasja@spbteam.com)
// Created: 10 July 2001
// Last changed: 26 July 2001
// Version: 1.0
// Description: Base class for HTML based dialog. Uses HtmlView control.
#if !defined(AFX_STHTMLDIALOG_H__20F36B80_D2F0_40B9_9C0D_984C726E43DA__INCLUDED_)
#define AFX_STHTMLDIALOG_H__20F36B80_D2F0_40B9_9C0D_984C726E43DA__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/////////////////////////////////////////////////////////////////////////////
// CSTHtmlDialog dialog is a super class for HTML based dialogs. It
// encapsulates working with htmlview.dll
class CSTHtmlDialog : public CDialog
{
public:
//Constructor
CSTHtmlDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL);
////////////////////////////////////////////////////
// Overrides
//This function is called when user clicks on a link.
//strHref parameter is a content of "href" attribute of "a" tag
//So if a user clicks on <a href="test">Test link</a>
//strHref will be "test"
//Rewrite this function to provide custom behaviour by
//default message window is shown
virtual void OnLink(const CString &strHref);
//This function sets HTML text and redraws the window
void SetHtml(const CString &strHtml);
//To use images in HTML you should register them before.
//strHtmlImageName should be a string that will be
//used in HTML in "src" attribute of "img" tag.
//This function adds image from bitmap resource with
//the given id.
void RegisterHtmlImage(int nResourceId, const CString& strHtmlImageName);
//To use images in HTML you should register them before.
//strHtmlImageName should be a string that will be
//used in HTML in "src" attribute of "img" tag.
//This function adds the given bitmap image.
void RegisterHtmlImage(CBitmap *pBitmap, const CString& strHtmlImageName);
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHtmlDialog)
protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
protected:
//This function deletes all images
virtual void DeleteHtmlImages();
//Initializes HTML view control
virtual void CreateHtmlWindow();
//Instance of dll to support HTML view control
static HINSTANCE m_HtmlViewInstance;
//Handle to HTML view control
HWND m_hwndHtml;
//List of images that will be accessible from HTML
CMapStringToOb m_imagesCache;
// Generated message map functions
//{{AFX_MSG(CHtmlDialog)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STHTMLDIALOG_H__20F36B80_D2F0_40B9_9C0D_984C726E43DA__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -