HTMLWindow Schnittstelle

Definition

Stellt ein HTML-Dokumentfenster dar.Represents an HTML document window.

public interface class HTMLWindow
public interface class HTMLWindow
__interface HTMLWindow
[System.Runtime.InteropServices.Guid("F6576203-FBCE-477E-A66B-EDA237BB68A7")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface HTMLWindow
[<System.Runtime.InteropServices.Guid("F6576203-FBCE-477E-A66B-EDA237BB68A7")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type HTMLWindow = interface
Public Interface HTMLWindow
Attribute

Beispiele

Sub HTMLWindowExample(ByVal dte As EnvDTE.DTE)  
    ' Open an HTML document before running this sample.  
    If TypeOf dte.ActiveDocument.ActiveWindow.Object Is HTMLWindow Then  
        ' Ask the user for a file to insert into the body of the HTML   
        ' document. This file should be an HTML fragment.  
        Dim strFile As String = InputBox("Enter the name of a file to _  
        insert at the end of the HTML document:")  
        ' Get the HTMLWindow object and determine which tab is   
        ' currently active.  
        Dim objHTMLWin As HTMLWindow = _  
        dte.ActiveDocument.ActiveWindow.Object  
        Dim Tab As vsHTMLTabs = objHTMLWin.CurrentTab  

        ' Switch to the "source" tab.  
        objHTMLWin.CurrentTab = vsHTMLTabs.vsHTMLTabsSource  

        ' Get an EditPoint at the start of the text.  
        Dim objTextWin As TextWindow = objHTMLWin.CurrentTabObject  
        Dim objEP As EditPoint = _  
        objTextWin.ActivePane.StartPoint.CreateEditPoint  

        ' Look for the end of the document body.  
        If objEP.FindPattern("</body>") Then  
            ' Insert the contents of the file.  
            objEP.InsertFromFile(strFile)  
        End If  

        ' Switch back to the original view of the HTML file.  
        objHTMLWin.CurrentTab = Tab  
    Else  
        MsgBox("You must open an HTML document.")  
    End If  
End Sub  
public void HTMLWindowExample(_DTE dte)  
{  
    // Open an HTML document before running this sample.  
    if (dte.ActiveDocument.ActiveWindow.Object is HTMLWindow)  
    {  
        HTMLWindow objHTMLWin;  
        vsHTMLTabs Tab;  
        String strFileName;  
        // Ask the user for a file to insert into the body of the HTML   
        // document. This file should be an HTML fragment.  
        strFileName = Microsoft.VisualBasic.Interaction.InputBox   
        ("Enter the name of a file to insert at the end of the HTML   
        document:","","",100,100);  
        // Get the HTMLWindow object and determine which tab is   
        // currently active.  
        objHTMLWin = dte.ActiveDocument.ActiveWindow.Object as   
        HTMLWindow;  
        Tab = objHTMLWin.CurrentTab;  

        // Switch to the "source" tab.  
        objHTMLWin.CurrentTab = vsHTMLTabs.vsHTMLTabsSource;  

        // Get an EditPoint at the start of the text.  
        TextWindow objTextWin;  
        EditPoint ep;  
        EditPoint ep2 = null;  
        TextRanges textRanges = null;  
        objTextWin = objHTMLWin.CurrentTabObject as TextWindow;  
        ep = objTextWin.ActivePane.StartPoint.CreateEditPoint();  
        textRanges = objTextWin.Selection.TextRanges;  

        // Look for the end of the document body.  
        if (ep.FindPattern   
        ("</body>",(int)vsFindOptions.vsFindOptionsNone, ref ep2, ref   
        textRanges))  
            // Insert the contents of the file.  
            ep.InsertFromFile (strFileName);  
            // Switch back to the original view of the HTML file.  
            objHTMLWin.CurrentTab = Tab;  
    }  
    else  
        MessageBox.Show ("You must open an HTML document.");  
}  

Hinweise

HTMLWindow wird von der- Object Eigenschaft des-Objekts zurückgegeben, Window Wenn das Dokument ein HTML-Dokument ist.HTMLWindow is returned by the Object property of the Window object when the document is an HTML document. Window.Selection und Document.Selection gibt ein- TextSelection Objekt zurück, wenn die- EnvDTE.HTMLWindow.CurrentTab Eigenschaft auf festgelegt ist vsHTMLTabsSource .Window.Selection and Document.Selection returns a TextSelection object when the EnvDTE.HTMLWindow.CurrentTab property is set to vsHTMLTabsSource.

Eigenschaften

CurrentTab

Ruft den Status (aktiv oder inaktiv) der Quell -oder Designer Registerkarte im HTML-Bearbeitungsfenster ab oder legt diesen fest.Gets or sets the state (active or inactive) of the Source or the Designer tab in the HTML edit window.

CurrentTabObject

Ruft den Status (aktiv oder inaktiv) der Quell -oder Designer Registerkarte im HTML-Bearbeitungsfenster ab.Gets the state (active or inactive) of the Source or the Designer tab in the HTML edit window.

DTE

Ruft das Erweiterbarkeitsobjekt der obersten Ebene ab.Gets the top-level extensibility object.

Parent

Ruft das unmittelbar übergeordnete Objekt eines HTMLWindow-Objekts ab.Gets the immediate parent object of a HTMLWindow object.

Gilt für: