Window2.Object 属性
获取在运行时可通过名称访问的对象。
命名空间: EnvDTE80
程序集: EnvDTE80(在 EnvDTE80.dll 中)
语法
声明
ReadOnly Property Object As Object
Object Object { get; }
property Object^ Object {
Object^ get ();
}
abstract Object : Object with get
function get Object () : Object
属性值
类型:Object
一个对象。
备注
返回该窗口所表示的工具的扩展性对象。
示例
此示例创建一个 OutputWindow 对象,然后使用它向 OutputWindowPane 对象中写入文本。
有关如何作为外接程序运行此示例的更多信息,请参见 如何:编译和运行自动化对象模型代码示例。
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)
ObjectExample(_applicationObject)
End Sub
Sub ObjectExample(ByVal dte As DTE2)
Dim win As Window2
win = _
CType(_applicationObject.Windows.Item _
(Constants.vsWindowKindOutput), Window2)
Dim output As OutputWindow
Dim outpane As OutputWindowPane
output = CType(win.Object(), OutputWindow)
outpane = output.OutputWindowPanes.Add("my output")
outpane.OutputString("Add test text to an Ouput _
pane obtained from the Window2.Object.")
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;
ObjectExample(_applicationObject);
}
public void ObjectExample (DTE2 dte)
{
Window2 win;
win =
(Window2)_applicationObject.Windows.Item
(Constants.vsWindowKindOutput);
OutputWindow output;
OutputWindowPane outpane;
output = (OutputWindow)win.Object;
outpane = output.OutputWindowPanes.Add("My Output");
outpane.OutputString("Add test text to an Ouput pane
obtained from the Window2.Object.");
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。