Share via


Window2 介面

Window 物件代表環境中的一個視窗。

命名空間:  EnvDTE80
組件:  EnvDTE80 (在 EnvDTE80.dll 中)

語法

'宣告
<GuidAttribute("25731932-3283-4AE0-B7CF-F4691B8BE523")> _
Public Interface Window2 _
    Inherits Window
[GuidAttribute("25731932-3283-4AE0-B7CF-F4691B8BE523")]
public interface Window2 : Window
[GuidAttribute(L"25731932-3283-4AE0-B7CF-F4691B8BE523")]
public interface class Window2 : Window
[<GuidAttribute("25731932-3283-4AE0-B7CF-F4691B8BE523")>]
type Window2 =  
    interface
        interface Window
    end
public interface Window2 extends Window

Window2 型別會公開下列成員。

屬性

  名稱 說明
公用屬性 AutoHides (繼承自 Window)。
公用屬性 AutoHides 取得或設定是否能隱藏 [工具] 視窗。
公用屬性 Caption (繼承自 Window)。
公用屬性 Caption 取得或設定視窗標題。
公用屬性 Collection (繼承自 Window)。
公用屬性 Collection 取得集合,此集合包含支援此屬性的 Window 物件。
公用屬性 CommandBars 取得目前視窗中所包含的 Microsoft.VisualStudio.CommandBars 集合。
公用屬性 ContextAttributes (繼承自 Window)。
公用屬性 ContextAttributes 取得 ContextAttributes 集合,它可以讓 Automation 用戶端將新屬性加入至目前 [動態說明] 視窗中選取的項目,並且為其他屬性提供內容說明。
公用屬性 Document (繼承自 Window)。
公用屬性 Document 取得與指定的項目相關聯的 Document (如果有的話)。
公用屬性 DocumentData[String] (繼承自 Window)。
公用屬性 DocumentData[String] 基礎架構。僅限 Microsoft 內部使用。
公用屬性 DTE (繼承自 Window)。
公用屬性 DTE 取得最上層的擴充性物件。
公用屬性 Height (繼承自 Window)。
公用屬性 Height 取得或設定值,指出視窗的維度,以像素為單位。
公用屬性 HWnd (繼承自 Window)。
公用屬性 HWnd 基礎架構。僅限 Microsoft 內部使用。
公用屬性 IsFloating (繼承自 Window)。
公用屬性 IsFloating 取得或設定值,指出 [工具] 視窗是否浮動於其他視窗之上。
公用屬性 Kind (繼承自 Window)。
公用屬性 Kind 基礎架構。僅限 Microsoft 內部使用。
公用屬性 Left (繼承自 Window)。
公用屬性 Left 取得或設定水平距離,此距離是物件內部左邊緣和其容器左邊緣之間的距離。
公用屬性 Linkable (繼承自 Window)。
公用屬性 Linkable 取得或設定值,指出此 [工具] 視窗是否可以與其他工具視窗一起停駐。
公用屬性 LinkedWindowFrame (繼承自 Window)。
公用屬性 LinkedWindowFrame 取得 Window 物件,表示包含視窗的視窗框架。
公用屬性 LinkedWindows (繼承自 Window)。
公用屬性 LinkedWindows 取得所有連結視窗的集合,此集合包含在連結視窗框架中。
公用屬性 Object (繼承自 Window)。
公用屬性 Object 取得物件,此物件可在執行階段中以名稱存取。
公用屬性 ObjectKind (繼承自 Window)。
公用屬性 ObjectKind 取得 Window.Object 物件的型別,它是一個 GUID 字串,代表視窗中所包含的工具。
公用屬性 Project (繼承自 Window)。
公用屬性 Project 取得與 Window 物件關聯的 Project 物件。
公用屬性 ProjectItem (繼承自 Window)。
公用屬性 ProjectItem 取得與 Window 物件關聯的 ProjectItem 物件。
公用屬性 Selection (繼承自 Window)。
公用屬性 Selection 取得物件,表示 Window 物件上目前的選取範圍。
公用屬性 Top (繼承自 Window)。
公用屬性 Top 取得或設定垂直距離,此距離為物件內部上邊緣和其容器上邊緣之間的距離。
公用屬性 Type (繼承自 Window)。
公用屬性 Type 基礎架構。僅限 Microsoft 內部使用。
公用屬性 Visible (繼承自 Window)。
公用屬性 Visible 取得或設定視窗的可視性。
公用屬性 Width (繼承自 Window)。
公用屬性 Width 取得或設定視窗寬度 (以字元為單位)。
公用屬性 WindowState (繼承自 Window)。
公用屬性 WindowState 取得或設定視窗狀態,例如是否為最小化、一般等等。

回頁首

方法

  名稱 說明
公用方法 Activate() (繼承自 Window)。
公用方法 Activate() 將焦點移至目前的項目。
公用方法 Attach(Int32) (繼承自 Window)。
公用方法 Attach(Int32) 基礎架構。僅限 Microsoft 內部使用。
公用方法 Close(vsSaveChanges) (繼承自 Window)。
公用方法 Close(vsSaveChanges) 關閉開啟的文件並選擇性儲存該文件,或者關閉並終結視窗。
公用方法 Detach() (繼承自 Window)。
公用方法 Detach() 基礎架構。僅限 Microsoft 內部使用。
公用方法 SetFocus() (繼承自 Window)。
公用方法 SetFocus() 基礎架構。僅限 Microsoft 內部使用。
公用方法 SetKind(vsWindowType) (繼承自 Window)。
公用方法 SetKind(vsWindowType) 基礎架構。僅限 Microsoft 內部使用。
公用方法 SetSelectionContainer(array<Object[]%) (繼承自 Window)。
公用方法 SetSelectionContainer(array<Object[]%) 當視窗為作用中時,允許在 屬性視窗 中將物件設為作用中。
公用方法 SetTabPicture(Object) (繼承自 Window)。
公用方法 SetTabPicture(Object) 將點陣圖載入至位於以標籤連結的 [工具] 視窗中的索引標籤式圖片。

回頁首

範例

這個範例中,會連結 [輸出視窗]、[命令視窗] 和 [方案總管]。 然後,它會操作這些連結視窗的寬度和高度,最後將它們從連結視窗框架全部卸除。

如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例

Imports EnvDTE
Imports EnvDTE80
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)
    LinkedWindowsExample(_applicationObject)
End Sub
Sub LinkedWindowsExample(ByVal dte As DTE2)
    Dim Frame As Window2
    Dim wins As Windows2
    wins = CType(_applicationObject.Windows, EnvDTE80.Windows2)
    Dim w1 As Window2 = _
 CType(_applicationObject.Windows.Item _
(Constants.vsWindowKindSolutionExplorer), EnvDTE80.Window2)
    Dim w2 As Window2 = _
 CType(_applicationObject.Windows.Item _
(Constants.vsWindowKindOutput), EnvDTE80.Window2)
    Dim w3 As Window2 = _
 CType(_applicationObject.Windows.Item _
(Constants.vsWindowKindCommandWindow), EnvDTE80.Window2)
    ' Create a linked window frame and dock Solution Explorer 
    ' and the Ouput window together inside it.
    Frame = CType(wins.CreateLinkedWindowFrame _
(w1, w2, vsLinkedWindowType.vsLinkedWindowTypeDocked), _
 EnvDTE80.Window2)
    MsgBox("Total number of windows in the linked window frame: " _
 & Frame.LinkedWindows.Count)
    ' Add another tool window, the Command window, to the frame with 
    ' the other two.
    Frame.LinkedWindows.Add(w3)
    MsgBox("Total number of windows in the linked window frame: " _
    & Frame.LinkedWindows.Count)
    ' Resize the entire linked window frame.
    Frame.Width = 500
    Frame.Height = 600
    MsgBox("Frame height and width changed. Now changing _
     Command window height.")
    ' Resize the height of the Command window.
    Frame.LinkedWindows.Item(3).Height = 800
    MsgBox("Now undocking the Command window from the frame.")
    ' Undock the Command window from the frame.
    Frame.LinkedWindows.Remove(w3)
    MsgBox("Now undocking the rest of the windows from the frame.")
    Frame.LinkedWindows.Remove(w2)
    Frame.LinkedWindows.Remove(w1)
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, ext_ConnectMode
 connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    LinkedWindowsExample(_applicationObject);
}
public void LinkedWindowsExample(DTE2 dte)
{
    Window2 Frame;
    Windows2 wins;
    wins = (EnvDTE80.Windows2)_applicationObject.Windows;
    Window2 w1 = 
(EnvDTE80.Window2)_applicationObject.Windows.Item
(Constants.vsWindowKindSolutionExplorer);
Window2 w2 =
 (EnvDTE80.Window2)_applicationObject.Windows.Item
(Constants.vsWindowKindOutput);
    Window2 w3 = 
(EnvDTE80.Window2)_applicationObject.Windows.Item
(Constants.vsWindowKindCommandWindow);
    // Create a linked window frame and dock Solution Explorer
    // and the Output window together inside it.
    Frame = (EnvDTE80.Window2)wins.CreateLinkedWindowFrame
(w1, w2, vsLinkedWindowType.vsLinkedWindowTypeDocked);
    MessageBox.Show("Total number of windows in the linked 
window frame: " + Frame.LinkedWindows.Count);
    // Add another tool window, the Command window, to the frame with
    // the other two.
    Frame.LinkedWindows.Add(w3);
    MessageBox.Show("Total number of windows in the linked 
window frame: " + Frame.LinkedWindows.Count);
    // Resize the entire linked window frame.
    Frame.Width = 500;
    Frame.Height = 600;
    MessageBox.Show("Frame height and width changed.
 Now changing Command window height.");
    // Resize the height of the Command window.
    Frame.LinkedWindows.Item(3).Height = 800;
    MessageBox.Show("Now undocking the Command window from 
the frame.");
    // Undock the Command window from the frame.
    Frame.LinkedWindows.Remove(w3);
    MessageBox.Show("Now undocking the rest of the windows 
from the frame.");
    Frame.LinkedWindows.Remove(w2);
    Frame.LinkedWindows.Remove(w1);
}

請參閱

參考

EnvDTE80 命名空間