Share via


Window2.WindowState Property

Gets or sets the state of the window, whether it is minimized, normal, and so forth.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Property WindowState As vsWindowState
vsWindowState WindowState { get; set; }
property vsWindowState WindowState {
    vsWindowState get ();
    void set (vsWindowState value);
}
abstract WindowState : vsWindowState with get, set
function get WindowState () : vsWindowState 
function set WindowState (value : vsWindowState)

Property Value

Type: EnvDTE.vsWindowState
A vsWindowState constant.

Remarks

Because the WindowState property sets or returns whether a window is maximized, minimized, or normal, the environment should be in MDI mode for the following to work correctly.

Examples

This creates a general text file and displays its WindowState property.

For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

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)
    WindowStateExample(_applicationObject)
End Sub
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 OnConnection(object application,
 ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    WindowStateExample(_applicationObject);
}
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());
}

.NET Framework Security

See Also

Reference

Window2 Interface

EnvDTE80 Namespace