Compartilhar via


HtmlTaskPane.HtmlWindow Propriedade

Definição

Obtém uma referência à interface IHTMLWindow2 do MSHTML para trabalhar com o documento HTML de um painel de tarefas personalizado.

public:
 abstract property System::Object ^ HtmlWindow { System::Object ^ get(); };
public abstract object HtmlWindow { get; }
member this.HtmlWindow : obj
Public MustOverride ReadOnly Property HtmlWindow As Object

Valor da propriedade

Um objeto IHTMLWindow2 associado ao arquivo HTML do painel de tarefas personalizado.

Exceções

O modelo de formulário não está configurado para Total Confiança usando a categoria Segurança e Confiança da caixa de diálogo Opções de Formulário.

Exemplos

No exemplo a seguir, a propriedade HtmlWindow da classe HtmlTaskPane é usada para definir uma referência ao objeto IHTMLWindow2 do painel de tarefas personalizado de um formulário totalmente confiável. Em seguida, o código chama a função personalizada TaskPaneSwitchView que é definida no código HTML do painel de tarefas personalizado.

// Get a reference to the custom task pane. It is always index [0]
// in the TaskPanes collection.
HtmlTaskPane custom = (Microsoft.Office.InfoPath.HtmlTaskPane)
   this.CurrentView.Window.TaskPanes[0];

// Get a reference to the parent window of the task pane.
IHTMLWindow2 window = (IHTMLWindow2)custom.HtmlWindow;

// Call into script through CLR late binding mechanism.
window.GetType().InvokeMember(
   "TaskPaneSwitchView",      // late bound method name.
   System.Reflection.BindingFlags.InvokeMethod | // binding flags
   System.Reflection.BindingFlags.DeclaredOnly |
   System.Reflection.BindingFlags.Public |
   System.Reflection.BindingFlags.Instance,
   null,     // binder object
   window,   // target object
   null);   // method arguments
' Get a reference to the custom task pane. It is always index (0)
' in the TaskPanes collection.
Dim custom As HtmlTaskPane = _
   DirectCast(Me.CurrentView.Window.TaskPanes(0), _
   Microsoft.Office.InfoPath.HtmlTaskPane)

  ' Get a reference to the parent window of the task pane.
   Dim window As IHTMLWindow2 = DirectCast(custom.HtmlWindow, _
      IHTMLWindow2

  ' Call into script through CLR late binding mechanism.
  window.GetType().InvokeMember( _
   "TaskPaneSwitchView", _
   System.Reflection.BindingFlags.InvokeMethod Or _
   System.Reflection.BindingFlags.DeclaredOnly Or _
   System.Reflection.BindingFlags.Public Or _
   System.Reflection.BindingFlags.Instance, _
   Nothing, _
   window, _
   Nothing)

Comentários

Usando a propriedade HtmlWindow , você pode chamar funções de script contidas no código HTML do painel de tarefas do código de formulário primário, manipular o código HTML do painel de tarefas e trabalhar com qualquer uma das propriedades e métodos que a interface IHTMLWindow2 fornece.

Observação: a propriedade HtmlWindow fornece a mesma funcionalidade que a HtmlDocument propriedade, mas só está disponível ao usar formulários totalmente confiáveis. Se o formulário não for totalmente confiável, você poderá usar a propriedade HtmlDocument .

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

Aplica-se a