HtmlElement.DomElement 属性   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取此元素的非托管接口指针。
public:
 property System::Object ^ DomElement { System::Object ^ get(); };
	public object DomElement { get; }
	member this.DomElement : obj
	Public ReadOnly Property DomElement As Object
	属性值
元素的 COM IUnknown 指针,可以将其强制转换为 HTML 元素接口中的某一个接口,如 IHTMLElement。
示例
下面的代码示例使用非托管接口获取当前所选文本,并将其转换为超链接,URL 由用户选择。 此代码是在以下假设下编写的,即窗体有一 WebBrowser 个名为 的 WebBrowser1控件,并且你已添加非托管 MSHTML 库作为对项目的引用。
private void CreateHyperlinkFromSelection()
{
    if (webBrowser1.Document != null)
    {
        MSHTML.IHTMLDocument2 iDoc = (MSHTML.IHTMLDocument2)webBrowser1.Document.DomDocument;
        if (iDoc != null)
        {
            MSHTML.IHTMLSelectionObject iSelect = iDoc.selection;
            if (iSelect == null)
            {
                MessageBox.Show("Please select some text before using this command.");
                return;
            }
            MSHTML.IHTMLTxtRange txtRange = (MSHTML.IHTMLTxtRange)iSelect.createRange();
            // Create the link.
            if (txtRange.queryCommandEnabled("CreateLink"))
            {
                Object o = null;
                txtRange.execCommand("CreateLink", true, o);
            }
        }
    }
}
Private Sub CreateHyperlinkFromSelection()
    If (WebBrowser1.Document IsNot Nothing) Then
        Dim IDoc = WebBrowser1.Document.DomDocument
        If (Not (IDoc Is Nothing)) Then
            Dim ISelect = IDoc.selection
            If (ISelect Is Nothing) Then
                MsgBox("Please select some text before using this command.")
                Exit Sub
            End If
            Dim TxtRange = ISelect.createRange()
            ' Create the link.
            If (TxtRange.queryCommandEnabled("CreateLink")) Then
                TxtRange.execCommand("CreateLink", True)
            End If
        End If
    End If
End Sub
	注解
              HtmlElement 是 Internet Explorer 文档对象模型 (DOM) 的包装器,它使用组件对象模型 (COM) 编写。 如果需要访问基础 COM 接口(例如 IHTMLElement)上的未公开属性或方法,可以使用此对象来查询它们。
若要使用非托管接口,需要将 MSHTML 库 (mshtml.dll) 导入应用程序。 但是,也可以使用 方法执行未公开的属性和方法 Invoke 。