标签: ihtmldocument

如何在不使用Web浏览器的情况下呈现HTML元素?

有没有办法在不使用任何Web浏览器控件的情况下在画布上绘制特定的HTML元素内容?

使用此代码,我将元素呈现给窗体的画布(仅作为示例).
它虽然有效,但这段代码不是一个好习惯 - 见下文,为什么......

uses
  SHDocVw, MSHTML;

procedure TForm1.Button1Click(Sender: TObject);
var
  WebBrowser: TWebBrowser;
  HTMLElement: IHTMLElement;
  HTMLRenderer: IHTMLElementRender;
begin
  WebBrowser := TWebBrowser.Create(nil);
  try
    WebBrowser.ParentWindow := Application.Handle;
    WebBrowser.Navigate('https://stackoverflow.com/questions/2975586/good-delphi-blogs');

    while WebBrowser.ReadyState < READYSTATE_COMPLETE do
      Application.ProcessMessages;

    HTMLElement := (WebBrowser.Document as IHTMLDocument3).getElementById('question');
    HTMLRenderer := (HTMLElement as IHTMLElementRender);
    HTMLRenderer.DrawToDC(Canvas.Handle);

  finally
    HTMLElement := nil;
    HTMLRenderer := nil;
    WebBrowser.Free;
  end;
end;
Run Code Online (Sandbox Code Playgroud)

这很糟糕,因为

有没有一种干净的方法来解决这个使用MSHTML?

html delphi mshtml ihtmldocument

15
推荐指数
1
解决办法
1万
查看次数

如何使用TIdHTTP中的字符串创建IHTMLDocument2?

我下载了一个URL IdHTTP.Get,我需要搜索HTML标签并提取一些数据.

我怎样才能将IdHTTP.Get返回的字符串转换为IHTMLDocument2

delphi indy html-parsing ihtmldocument

6
推荐指数
2
解决办法
2万
查看次数

MSHTML教程

我想学习一些关于MSHTML的基础知识,比如如何使用IHtmlDocument和IHtmlDocument2接口.我搜索了很长一段时间,但找不到初学者的教程.有人可以推荐一些东西吗?

编辑:我更喜欢使用C#.

mshtml ihtmldocument ihtmldocument2

5
推荐指数
1
解决办法
7867
查看次数

如何获取mshtml.IHTMLDocument6或mshtml.IHTMLDocument7?

我在Windows 7中使用IE11.然后我在C#项目c:\ Windows\System32\mshtml.tld中添加了一个引用并尝试获取mshtml.IHTMLDocument6或mshtml.IHTMLDocument7,但VS2013没有看到它.我只能得到mshtml.IHTMLDocument,mshtml.IHTMLDocument2 .. mshtml.IHTMLDocument5.

IHTMLDocument7接口 https://msdn.microsoft.com/ru-ru/library/windows/hardware/ff975572

c# ihtmldocument internet-explorer-11

2
推荐指数
1
解决办法
877
查看次数