この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

HTMLWindow インターフェイス

HTML ドキュメント ウィンドウを表します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)
[GuidAttribute("F6576203-FBCE-477E-A66B-EDA237BB68A7")]
public interface HTMLWindow

HTMLWindow 型で公開されるメンバーは以下のとおりです。

  名前 説明
パブリック プロパティ CurrentTab HTML 編集ウィンドウの [ソース] タブまたは [デザイナー] タブの状態 (アクティブまたは非アクティブ) を取得または設定します。
パブリック プロパティ CurrentTabObject HTML 編集ウィンドウの [ソース] タブまたは [デザイナー] タブの状態 (アクティブまたは非アクティブ) を取得します。
パブリック プロパティ DTE トップレベルの機能拡張オブジェクトを取得します。
パブリック プロパティ Parent HTMLWindow オブジェクトの直接の親オブジェクトを取得します。
このページのトップへ

HTML ドキュメントの場合、Window オブジェクトの Object プロパティは HTMLWindow を返します。 HTMLWindow.CurrentTab プロパティが vsHTMLTabsSource に設定されている場合、Window.Selection および Document.SelectionTextSelection オブジェクトを返します。

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.");
}
この情報は役に立ちましたか。
(残り 1500 文字)
コミュニティ コンテンツ 追加
注釈 FAQ