Compartilhar via


Window2.Width Property

Gets or sets the width of the window in character units.

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

Syntax

'Declaration
Property Width As Integer
int Width { get; set; }
property int Width {
    int get ();
    void set (int value);
}
abstract Width : int with get, set
function get Width () : int 
function set Width (value : int)

Property Value

Type: Int32
The width of the window in character units.

Examples

This example selects the first window in the Windows collection, and displays its Width 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)
    WidthExample(_applicationObject)
End Sub
Sub WidthExample(ByVal dte As DTE2)
    Dim objWin As Window2
    objWin = CType(_applicationObject.Windows.Item(1), Window2)
    MsgBox("Window width of " & objWin.Caption & " is " & objWin.Width)
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;
    WidthExample(_applicationObject);
}
public void WidthExample(DTE2 dte)
{
    Window2 objWin;
    objWin = (Window2)_applicationObject.Windows.Item(1);
    MessageBox.Show("Window width of " + objWin.Caption + " is " 
+ objWin.Width);
}

.NET Framework Security

See Also

Reference

Window2 Interface

EnvDTE80 Namespace