CustomTaskPaneCollection.RemoveAt 方法

移除 CustomTaskPaneCollection 的指定索引处的 CustomTaskPane

命名空间:  Microsoft.Office.Tools
程序集:  Microsoft.Office.Tools.Common(在 Microsoft.Office.Tools.Common.dll 中)

语法

声明
Sub RemoveAt ( _
    index As Integer _
)
void RemoveAt(
    int index
)

参数

异常

异常 条件
ArgumentOutOfRangeException

集合的 index 处不包含 CustomTaskPane

ObjectDisposedException

已经对 CustomTaskPaneCollection 调用了 Dispose 方法。

备注

如果外接程序不再需要自定义任务窗格,则可以使用 RemoveAt 方法,在外接程序仍在运行时清理任务窗格使用的资源。使用此方法时,会自动调用指定 CustomTaskPane 对象的 Dispose 方法。

Visual Studio Tools for Office Runtime 会在卸载外接程序时自动清理自定义任务窗格使用的资源。不要在项目中的 ThisAddIn_Shutdown 事件处理程序中调用 RemoveAt 方法。此方法将引发 ObjectDisposedException,因为 Visual Studio Tools for Office Runtime 会在调用 ThisAddIn_Shutdown 之前清理 CustomTaskPane 对象使用的资源。

.NET Framework 安全性

请参见

参考

CustomTaskPaneCollection 接口

Microsoft.Office.Tools 命名空间