Window2.Width 属性

获取或设置窗口的宽度(以字符为单位)。

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

语法

声明
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)

属性值

类型:Int32
窗口的宽度(以字符为单位)。

示例

此示例选择 Windows 集合中的第一个窗口,然后显示它的 Width 属性。

有关如何作为外接程序运行此示例的更多信息,请参见 如何:编译和运行自动化对象模型代码示例

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 安全性

请参阅

参考

Window2 接口

EnvDTE80 命名空间