Edytuj

Udostępnij za pośrednictwem


TaskPaneObject Interface

Definition

Represents a task pane in a Microsoft Office InfoPath form that is associated with a window.

public interface class TaskPaneObject : Microsoft::Office::Interop::InfoPath::TaskPane
[System.Runtime.InteropServices.Guid("096CD58E-0786-11D1-95FA-0080C78EE3BB")]
public interface TaskPaneObject : Microsoft.Office.Interop.InfoPath.TaskPane
type TaskPaneObject = interface
    interface TaskPane
Public Interface TaskPaneObject
Implements TaskPane
Derived
Attributes
Implements

Examples

In the following example, the Item[Object] property of the TaskPanesCollection collection is used to get a reference to the TaskPane object that represents the custom task pane. The code then calls a scripting function defined in the HTML code of the custom task pane using the HTMLDocument property of the HTMLTaskPaneObject object, which is inherited by the TaskPane object.

// 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);
 }
}

Note: The above example requires a reference to the Microsoft.mshtml.dll assembly.

Remarks

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeTaskPane.

The TaskPaneObject object provides properties for working with the InfoPath built-in task panes. The HTMLTaskPaneObject object inherits those properties for working with a custom task pane.

The properties available for an InfoPath task pane are determined by the type of task pane that you are working with. If the TaskPaneType property returns 0, the task pane is a custom task pane and the properties and methods available are provided by the HTMLTaskPane object. If the TaskPaneType property returns any other value, the task pane is a built-in task pane and the properties are provided by the TaskPaneObject object.

Note: TaskPaneType is based on XdTaskPaneType enumeration. These enumerated values are also used as arguments to the property Item[Object] of the TaskPanesCollection collection for returning a reference to a specified type of task pane.

Properties

TaskPaneType

Gets a value indicating the type of task pane represented by the TaskPaneObject object.

(Inherited from TaskPane)
Visible

Gets or sets a value indicating that the task pane represented by the TaskPaneObject object is visible in the Microsoft Office InfoPath 2003 user interface.

(Inherited from TaskPane)

Applies to