HTMLWindow3 인터페이스
Visual Studio IDE(통합 개발 환경)에서 HTML 문서 창을 나타냅니다.
네임스페이스: EnvDTE90
어셈블리: EnvDTE90(EnvDTE90.dll)
구문
‘선언
<GuidAttribute("BAD0A3DD-8109-4684-B806-A5282267BFE4")> _
Public Interface HTMLWindow3
[GuidAttribute("BAD0A3DD-8109-4684-B806-A5282267BFE4")]
public interface HTMLWindow3
[GuidAttribute(L"BAD0A3DD-8109-4684-B806-A5282267BFE4")]
public interface class HTMLWindow3
[<GuidAttribute("BAD0A3DD-8109-4684-B806-A5282267BFE4")>]
type HTMLWindow3 = interface end
public interface HTMLWindow3
HTMLWindow3 형식에서는 다음과 같은 멤버를 노출합니다.
속성
이름 | 설명 | |
---|---|---|
![]() |
CurrentPane | 현재 HTML 편집기 창의 형식을 가져오거나 설정합니다. |
![]() |
CurrentView | HTML 편집기 창의 상태(소스, 디자이너 또는 분할 뷰)를 가져오거나 설정합니다. |
위쪽
메서드
이름 | 설명 | |
---|---|---|
![]() |
WaitForBackgroundProcessingComplete | 백그라운드 처리가 완료될 때까지 프로그램 실행을 일시 중지합니다. |
위쪽
설명
문서가 HTML 문서인 경우 Window 개체의 Object 속성에서 HTMLWindow3가 반환됩니다.CurrentTab 속성이 vsHTMLTabsSource로 설정된 경우에는 Window.Selection 및 Document.Selection에서 TextSelection 개체를 반환합니다.
Visual Studio 2008 HTML 편집기에 분할 뷰가 도입되어 HTMLWindow3, vsHTMLPanes 및 vsHTMLViews가 추가되었습니다.분할 뷰는 HTML 편집기 창의 탭 및 뷰 요소를 구분합니다.뷰(디자인 또는 소스)를 전환하더라도 탭(디자인/분할/소스)이 반드시 전환되지는 않습니다.예를 들어 분할 탭을 클릭하면 디자인 및 소스 뷰 간에 전환해도 탭이 변경되지 않습니다. 단지 분할 뷰에서 디자인 및 소스 부분이 활성화되거나 비활성화됩니다.
이제 Visual Studio 2008 HTMLWindow 개체에서도 현재 뷰(디자인 또는 소스)와 현재 창(디자인, 소스 또는 분할 탭)을 반환하는 HTMLWindow3 인터페이스를 구현합니다.
HTMLWindow3 규칙
HTMLWindow3 동작은 다음과 같습니다.
Get
현재 창(탭) |
현재 뷰 반환 |
---|---|
활성화된 부분에 따라 vsHTMLViewDesign 또는 vsHTMLViewSource입니다. |
Set
현재 창(탭) |
설정 |
---|---|
|
|
|
|
|
예제
Sub HTMLWindow3Example(ByVal dte As EnvDTE80.DTE2)
' Open an HTML document before running this sample.
If TypeOf dte.ActiveDocument.ActiveWindow.Object Is HTMLWindow3 _
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 HTMLWindow3 object and determine which tab is
' currently active.
Dim objHTMLWin As HTMLWindow3 = _
CType(dte.ActiveDocument.ActiveWindow.Object, HTMLWindow3)
Dim Tab As vsHTMLTabs = CType(objHTMLWin.CurrentTab, _
vsHTMLTabs)
Dim cpane As vsHTMLPanes = vsHTMLPanes.vsHTMLPaneSplit
' Switch to the "split" view, source view.
objHTMLWin.CurrentPane = vsHTMLPanes.vsHTMLPaneSplit
objHTMLWin.CurrentView = vsHTMLViews.vsHTMLViewSource
' Get an EditPoint at the start of the text.
Dim objTextWin As TextWindow = _
CType(objHTMLWin.CurrentTabObject, TextWindow)
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 HTMLWindow3)
{
HTMLWindow3 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 HTMLWindow3 object and determine which tab is
// currently active.
objHTMLWin = dte.ActiveDocument.ActiveWindow.Object as
HTMLWindow3;
Tab = objHTMLWin.CurrentTab;
// Switch to the "source" tab.
objHTMLWin.CurrentPane = vsHTMLPanes.vsHTMLPaneSplit;
objHTMLWin.CurrentTab = vsHTMLViews.vsHTMLViewSource;
// 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.");
}