TaskPaneObject 接口

代表与一个窗口关联的 Microsoft InfoPath 表单中的任务窗格。

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
<GuidAttribute("096cd58e-0786-11d1-95fa-0080c78ee3bb")> _
Public Interface TaskPaneObject _
    Inherits TaskPane
用法
Dim instance As TaskPaneObject
[GuidAttribute("096cd58e-0786-11d1-95fa-0080c78ee3bb")]
public interface TaskPaneObject : TaskPane

备注

此类型是用于 Coclass(托管代码需要此 Coclass 来实现 COM 互操作性)的包装。使用此类型来访问由此 Coclass 实现的 COM 接口。有关 COM 接口的信息(包括指向其成员说明的链接),请参阅TaskPane.

TaskPaneObject 对象提供的属性用来使用 InfoPath 内置的任务窗格。HTMLTaskPaneObject 对象继承了这些属性来使用自定义任务窗格。

可供 InfoPath 任务窗格使用的属性由所使用的任务窗格类型决定。如果 TaskPaneType 属性返回 0,则任务窗格为自定义任务窗格,并且由 HTMLTaskPane 对象提供可用的属性和方法。如果 TaskPaneType 属性返回任何其他值,则任务窗格为内置任务窗格,并且由 TaskPaneObject 对象提供属性。

备注

TaskPaneType 基于 XdTaskPaneType 枚举。这些枚举值还用作 TaskPanesCollection 集合的 Item 属性的参数,以返回对指定类型的任务窗格的引用。

示例

在以下示例中,TaskPanesCollection 集合的 Item 属性用于获取一个对表示自定义任务窗格的 TaskPane 对象的引用。然后此代码使用 HTMLTaskPaneObject 对象的 HTMLDocument 属性(由 TaskPane 对象继承)调用在自定义任务窗格的 HTML 代码中定义的脚本函数。

// Ensure View has loaded before trying to access the task pane.
if (thisXDocument.View != null)
{
 // Get a reference to the custom task pane.  It is always the 0-th
 // task pane in the TaskPanes collection.
 HTMLTaskPane custom = (HTMLTaskPane) thisXDocument.View.Window.TaskPanes[0];

 // Ensure that the task pane is completely loaded.
 if (custom != null && custom.HTMLDocument.readyState == "complete")
 {
  mshtml.IHTMLWindow2 window = custom.HTMLDocument.parentWindow;

  object[] args =  new object[] {"ViewID"};

  // call into script through CLR late binding mechanism
  window.GetType().InvokeMember(
   "SelectView",      // late bound method      
   System.Reflection.BindingFlags.InvokeMethod |   // binding flags
   System.Reflection.BindingFlags.DeclaredOnly | 
   System.Reflection.BindingFlags.Public | 
   System.Reflection.BindingFlags.Instance,     
   null,        // binder object
   window,        // target object
   args);
 }
}

备注

以上示例需要一个对 Microsoft.mshtml.dll 程序集的引用。

另请参阅

引用

TaskPaneObject 成员

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间