共用方式為


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)

屬性值

型別:System.Int32
以字元為單位的視窗寬度。

範例

這個範例會選取 Windows 集合中的第一個視窗,並顯示這個視窗的 Width 屬性。

如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例

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 介面

Width 多載

EnvDTE80 命名空間