Document.ActiveWindow 属性

获取当前活动窗口,如果没有其他活动窗口,则获取最顶层的窗口。 如果没有打开窗口,则返回 Nothing。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
ReadOnly Property ActiveWindow As Window
Window ActiveWindow { get; }
property Window^ ActiveWindow {
    Window^ get ();
}
abstract ActiveWindow : Window with get
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 命名空间