Document.ActiveWindow 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取当前处于活动状态的窗口,如果没有其他活动窗口,则为最顶部的窗口。 如果没有打开窗口,则返回 Nothing。
public:
property EnvDTE::Window ^ ActiveWindow { EnvDTE::Window ^ get(); };
public:
property EnvDTE::Window ^ ActiveWindow { EnvDTE::Window ^ get(); };
[System.Runtime.InteropServices.DispId(102)]
public EnvDTE.Window ActiveWindow { [System.Runtime.InteropServices.DispId(102)] get; }
[<System.Runtime.InteropServices.DispId(102)>]
[<get: System.Runtime.InteropServices.DispId(102)>]
member this.ActiveWindow : EnvDTE.Window
Public ReadOnly Property ActiveWindow As Window
属性值
Window 对象。
- 属性
示例
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);
}
}
注解
ActiveWindow 返回文档的活动窗口。 只能在工具窗口上设置标题。 如果尝试在其他窗口类型(如文档窗口)上设置标题,会收到错误 "未指定的错误"。