如何在基于对话框的应用程序上使用CHTMLView类。 [英] How to use CHTMLView class on dialog based application.

查看:114
本文介绍了如何在基于对话框的应用程序上使用CHTMLView类。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





任何人都可以告诉我如何在基于对话框的应用程序中使用CHTMLView类。我想在MFC对话框中显示HTML文档的预览。



提前感谢。

Hi,

Can anyone tell me how to use CHTMLView class in dialog based application. I want to show preview of the HTML document on the MFC dialog.

Thanks in advance.

推荐答案

MFC View类确实需要完整的Document / View架构,所以你需要的是封装在CHTMLView类中的HTML控件。



有几篇文章这里涵盖了你需要的东西 -

http://www.codeproject。 com / KB / miscctrl / simplebrowserformfc.aspx [ ^ ]和 http://www.codeproject.com/KB/MFC/dhtmldialog.aspx [ ^ ]例如。
The MFC View classes really need the full Document/View architecture, so what you need is the HTML control that is encapsulated in the CHTMLView class.

There are several articles here that cover the sort of thing you need -
http://www.codeproject.com/KB/miscctrl/simplebrowserformfc.aspx[^] and http://www.codeproject.com/KB/MFC/dhtmldialog.aspx[^] for example.


你不需要doc / view架构,这是一个简单的解决方案。



1)在对话框头文件中添加:



You dont need doc/view architecture, here is a simple solution.

1) In your dialog header file add:

CDHtmlDialog	m_HtmCtrl;





2)在对话框上放置一个图片控件。



3)在你的对话框OnInit函数中添加:





2) Place a picture control on your dialog.

3) In your dialog OnInit function add:

VERIFY(m_HtmCtrl.SubclassDlgItem(IDC_PICTURE_CTRL, this));
m_HtmCtrl.OnInitDialog();
m_HtmCtrl.Navigate(_T("SomePage.htm"));





4)您可能已经拥有此功能,但请确保以下内容包含在您的stdafx文件中:





4) You probably already have this but make sure the following include is in your stdafx file:

#include <afxdhtml.h>


这篇关于如何在基于对话框的应用程序上使用CHTMLView类。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆