Document.ActiveWindow 屬性

取得目前使用中的視窗;如果沒有其他使用中視窗,則取得最上層顯示視窗 (Topmost Window)。 如果沒有開啟任何視窗,傳回 Nothing。

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

語法

'宣告
ReadOnly Property ActiveWindow As Window
    Get
Window ActiveWindow { get; }
property Window^ ActiveWindow {
    Window^ get ();
}
abstract ActiveWindow : Window
function get ActiveWindow () : Window

屬性值

型別:EnvDTE.Window
Window 物件。

備註

ActiveWindow 傳回文件的使用中視窗。 您只能設定 [工具] 視窗上的標題。 如果您嘗試設定其他類型視窗的標題,例如 [文件] 視窗,則會發生「未指定的錯誤」。

範例

public void WindowExample(DTE2 dte)
{  // Before running, create a text file named 
   // "TextFile1.txt", include it in your solution,
   // and select some text.
   Window win;
   Document doc;
   if (dte.Documents.Count > 0)
   {
      doc = dte.Documents.Item("TextFile1.txt");
      win = doc.ActiveWindow;
      // Show the name of the project that contains this window and document.
      MessageBox.Show(win.Project.Name);
   }
}

.NET Framework 安全性

請參閱

參考

Document 介面

EnvDTE 命名空間