Window2.WindowState 属性

定义

获取或设置窗口的状态,是否为最小化和正常大小等等。

public:
 property EnvDTE::vsWindowState WindowState { EnvDTE::vsWindowState get(); void set(EnvDTE::vsWindowState value); };
public:
 property EnvDTE::vsWindowState WindowState { EnvDTE::vsWindowState get(); void set(EnvDTE::vsWindowState value); };
[System.Runtime.InteropServices.DispId(109)]
public EnvDTE.vsWindowState WindowState { [System.Runtime.InteropServices.DispId(109)] get; [System.Runtime.InteropServices.DispId(109)] set; }
[<System.Runtime.InteropServices.DispId(109)>]
[<get: System.Runtime.InteropServices.DispId(109)>]
[<set: System.Runtime.InteropServices.DispId(109)>]
member this.WindowState : EnvDTE.vsWindowState with get, set
Public Property WindowState As vsWindowState

属性值

vsWindowState

一个 vsWindowState 常数。

实现

属性

示例

这将创建一个常规文本文件并显示其 WindowState 属性。

Imports EnvDTE  
Imports EnvDTE80  
Sub WindowStateExample(ByVal dte As DTE2)  
    Dim win As Window2  
    win = CType(_applicationObject.ItemOperations.NewFile _  
    ("General\Text File"), Window2)  
    MsgBox("Windowstate of " & win.Caption & " is "  _  
    & (win.WindowState.ToString))  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void WindowStateExample(DTE2 dte)  
{  
    Window2 win;  
    win = (Window2)_applicationObject.ItemOperations.NewFile  
(@"General\Text File", "MyTextFile", Constants.vsViewKindTextView);  
    MessageBox.Show("Windowstate of " + win.Caption + " is "   
+ win.WindowState.ToString());  
}  

注解

由于 WindowState 属性设置或返回窗口是最大化、最小化还是正常,因此环境应处于 MDI 模式下,以使以下操作正常工作。

适用于