Dil

HtmlElement.DomElement Özellik

Tanım

Bu öğe için yönetilmeyen bir arabirim işaretçisi alır.

public:
 property System::Object ^ DomElement { System::Object ^ get(); };
public object DomElement { get; }
member this.DomElement : obj
Public ReadOnly Property DomElement As Object

Özellik Değeri

gibi HTML öğesi arabirimlerinden IUnknownbirine dönüştürebileceğiniz öğenin COM IHTMLElement işaretçisi.

Örnekler

Aşağıdaki kod örneği, şu anda seçili olan metni almak ve kullanıcı tarafından seçilen URL ile köprüye dönüştürmek için yönetilmeyen arabirimler kullanır. Bu kod, formunuzun adlı WebBrowserbir WebBrowser1 denetimi olduğu ve yönetilmeyen MSHTML kitaplığını projenize başvuru olarak eklediğiniz varsayımı altında yazılmıştır.

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

Açıklamalar

HtmlElement, Bileşen Nesne Modeli (COM) kullanılarak yazılan Internet Explorer Belge Nesne Modeli (DOM) için bir sarmalayıcıdır. gibi IHTMLElementtemel COM arabirimlerinde kullanıma sunulmayan özelliklere veya yöntemlere erişmeniz gerekiyorsa, bunları sorgulamak için bu nesneyi kullanabilirsiniz.

Yönetilmeyen arabirimleri kullanmak için MSHTML kitaplığını (mshtml.dll) uygulamanıza aktarmanız gerekir. Ancak, yöntemini kullanarak Invoke kullanıma sunulmayan özellikleri ve yöntemleri de yürütebilirsiniz.

Şunlara uygulanır

Ayrıca bkz.