WindowVisibilityEvents 인터페이스
ToolWindows의 표시 여부(숨김 또는 표시)를 지정합니다.이 기능을 위해 이 개체를 사용합니다. 이 개체의 설명서는 WindowVisibilityEventsClass를 참조하십시오.
네임스페이스: EnvDTE80
어셈블리: EnvDTE80(EnvDTE80.dll)
구문
‘선언
<GuidAttribute("84DE07BC-43A2-4275-BCF9-D207D20E49ED")> _
Public Interface WindowVisibilityEvents _
Inherits _WindowVisibilityEvents, _dispWindowVisibilityEvents_Event
[GuidAttribute("84DE07BC-43A2-4275-BCF9-D207D20E49ED")]
public interface WindowVisibilityEvents : _WindowVisibilityEvents,
_dispWindowVisibilityEvents_Event
[GuidAttribute(L"84DE07BC-43A2-4275-BCF9-D207D20E49ED")]
public interface class WindowVisibilityEvents : _WindowVisibilityEvents,
_dispWindowVisibilityEvents_Event
[<GuidAttribute("84DE07BC-43A2-4275-BCF9-D207D20E49ED")>]
type WindowVisibilityEvents =
interface
interface _WindowVisibilityEvents
interface _dispWindowVisibilityEvents_Event
end
public interface WindowVisibilityEvents extends _WindowVisibilityEvents, _dispWindowVisibilityEvents_Event
WindowVisibilityEvents 형식에서는 다음과 같은 멤버를 노출합니다.
메서드
이름 | 설명 | |
---|---|---|
![]() |
add_WindowHiding | 인프라입니다. Microsoft 내부용입니다. (_dispWindowVisibilityEvents_Event에서 상속됨) |
![]() |
add_WindowShowing | 인프라입니다. Microsoft 내부용입니다. (_dispWindowVisibilityEvents_Event에서 상속됨) |
![]() |
remove_WindowHiding | 인프라입니다. Microsoft 내부용입니다. (_dispWindowVisibilityEvents_Event에서 상속됨) |
![]() |
remove_WindowShowing | 인프라입니다. Microsoft 내부용입니다. (_dispWindowVisibilityEvents_Event에서 상속됨) |
위쪽
이벤트
이름 | 설명 | |
---|---|---|
![]() |
WindowHiding | 인프라입니다. Microsoft 내부용입니다. (_dispWindowVisibilityEvents_Event에서 상속됨) |
![]() |
WindowShowing | 인프라입니다. Microsoft 내부용입니다. (_dispWindowVisibilityEvents_Event에서 상속됨) |
위쪽
예제
이 예제에서는 추가 기능을 사용하여 WindowVisibilityEvents에 연결합니다.Connect.vb 또는 Connect.cs 파일의 코드를 아래에 있는 예제 코드로 바꿉니다.Visual Studio IDE에서 이 추가 기능을 실행하고 명령 창과 출력 창을 열거나 닫아 메서드를 캡처하는 이벤트가 어떻게 작동하는지 확인합니다.자동화 예제를 실행하는 방법에 대한 자세한 내용은 방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행을 참조하십시오.
Imports System
Imports Microsoft.VisualStudio.CommandBars
Imports Extensibility
Imports EnvDTE
Imports EnvDTE80
Public Class Connect
Implements IDTExtensibility2
Dim applicationObject As DTE2
Dim addInInstance As AddIn
Public WithEvents windowsVisEvents As EnvDTE80.WindowVisibilityEvents
Public Sub New()
End Sub
Public Sub OnConnection(ByVal application As Object, _
ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
applicationObject = CType(application, DTE2)
addInInstance = CType(addInInst, AddIn)
Dim toolwin As EnvDTE80.ToolWindows
toolwin = applicationObject.ToolWindows
windowsVisEvents = CType(toolwin.DTE.Events, _
Events2).WindowVisibilityEvents
End Sub
Private Sub windowsVisEvents_WindowHiding(ByVal Window As _
EnvDTE.Window) Handles windowsVisEvents.WindowHiding
MsgBox(Window.Caption & " is hiding.")
End Sub
Private Sub windowsVisEvents_WindowShowing(ByVal Window As _
EnvDTE.Window) Handles windowsVisEvents.WindowShowing
MsgBox(Window.Caption & " is showing.")
End Sub
Public Sub OnDisconnection(ByVal disconnectMode _
As ext_DisconnectMode, ByRef custom As Array) Implements _
IDTExtensibility2.OnDisconnection
windowsVisEvents = Nothing
End Sub
Public Sub OnAddInsUpdate(ByRef custom As Array) Implements _
IDTExtensibility2.OnAddInsUpdate
End Sub
Public Sub OnStartupComplete(ByRef custom As Array) Implements _
IDTExtensibility2.OnStartupComplete
End Sub
Public Sub OnBeginShutdown(ByRef custom As Array) Implements _
IDTExtensibility2.OnBeginShutdown
End Sub
End Class
namespace CS_Events_Code
{
using System;
using Microsoft.VisualStudio.CommandBars;
using Extensibility;
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public class Connect : Object, IDTExtensibility2
{
public Connect()
{
}
public void OnConnection(object application, ext_ConnectMode
connectMode, object addInInst, ref Array custom)
{
applicationObject = (DTE2)application;
addInInstance = (AddIn)addInInst;
EnvDTE80.Events2 events = (EnvDTE80.Events2
)applicationObject.Events;
windowsVisEvents =
(EnvDTE80.WindowVisibilityEvents)events.get_WindowVisibilityEvents
(null);
// Connect to each delegate exposed from the windows visibiliy
// events object retrieved above
windowsVisEvents.WindowHiding +=new
_dispWindowVisibilityEvents_WindowHidingEventHandler
(this.WindowHiding);
windowsVisEvents.WindowShowing +=new
_dispWindowVisibilityEvents_WindowShowingEventHandler
(this.WindowShowing);
}
public void OnDisconnection(ext_DisconnectMode disconnectMode,
ref Array custom)
{
if (windowsVisEvents != null)
{
windowsVisEvents.WindowHiding -= new
_dispWindowVisibilityEvents_WindowHidingEventHandler
(this.WindowHiding);
windowsVisEvents.WindowShowing -= new
_dispWindowVisibilityEvents_WindowShowingEventHandler
(this.WindowShowing);
}
}
public void OnAddInsUpdate(ref Array custom)
{
}
public void OnStartupComplete(ref Array custom)
{
}
public void OnBeginShutdown(ref Array custom)
{
}
private DTE2 applicationObject;
private AddIn addInInstance;
private EnvDTE80.WindowVisibilityEvents windowsVisEvents;
public void WindowHiding(EnvDTE.Window winRef)
{
MessageBox.Show("The window " + winRef.Caption + " is hiding.");
}
public void WindowShowing(EnvDTE.Window winRef)
{
MessageBox.Show("The window " + winRef.Caption + " is showing.");
}
}
}