CustomTaskPaneCollection.Remove(CustomTaskPane) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从 CustomTaskPane 中移除指定的 CustomTaskPaneCollection。
public bool Remove (Microsoft.Office.Tools.CustomTaskPane customTaskPane);
参数
- customTaskPane
- CustomTaskPane
要从该集合中移除的 CustomTaskPane。
返回
如果从集合中成功移除了 CustomTaskPane,则为 true;如果集合中不包含指定的 CustomTaskPane,则为 false。
例外
customTaskPane 为 null。
已在 CustomTaskPaneCollection 上调用 Microsoft.Office.Tools.CustomTaskPaneCollection.Dispose 方法。
注解
如果外接程序不再需要自定义任务窗格,则可以使用 Remove 方法清理加载项仍在运行时任务窗格使用的资源。 使用此方法时,将 <xref:Microsoft.Office.Tools.CustomTaskPane.Dispose%2A> CustomTaskPane 自动调用指定对象的方法。
Visual Studio Tools for Office Runtime卸载外接程序时,会自动清理自定义任务窗格使用的资源。 不要在 Remove ThisAddIn_Shutdown 项目中的事件处理程序中调用方法。 此方法将引发 ObjectDisposedException ,因为在 Visual Studio Tools for Office Runtime CustomTaskPane 调用之前会清除对象使用的资源 ThisAddIn_Shutdown 。