SignatureCollection.CreateSignature 方法

定义

创建一个新 Signature 对象,而不将其添加到窗体。

public:
 abstract Microsoft::Office::InfoPath::Signature ^ CreateSignature();
public abstract Microsoft.Office.InfoPath.Signature CreateSignature ();
abstract member CreateSignature : unit -> Microsoft.Office.InfoPath.Signature
Public MustOverride Function CreateSignature () As Signature

返回

一个新的 Signature 对象,该对象包含视图的快照以及其他签名信息。

例外

没有使用“表单选项”对话框的“安全和信任”类别将表单模板配置为“完全信任”。

示例

下面的示例显示了当您为 Sign 事件添加事件处理程序时,添加到表单模板的代码框架。 该示例使用 CreateSignature 方法来创建一个新的 Signature 对象。 调用 Signature 类的 Sign 方法时,新的 Signature 对象将添加到表单的 SignatureCollection 对象。

public void FormEvents_Sign(object sender, SignEventArgs e)
{
   // This event handler will run only in fully trusted form templates.

   Signature thisSignature = 
      e.SignedDataBlock.Signatures.CreateSignature();

   // To add other pieces of information to sign, modify the
   // signature template returned by
   // thisSignature.SignatureBlockXmlNode.
   // Write your code here.

   thisSignature.Sign();
   e.SignatureWizard = false;
}
Public Sub FormEvents_Sign(ByVal sender As Object, _
   ByVal e As SignEventArgs)

   ' This event handler will run only in fully trusted form templates.

   Dim thisSignature As Signature = _
      e.SignedDataBlock.Signatures.CreateSignature()

   ' To add other pieces of information to sign, modify the
   ' signature template returned by
   ' thisSignature.SignatureBlockXmlNode.
   ' Write your code here.

   thisSignature.Sign()
   e.SignatureWizard = False
End Sub

注解

CreateSignature 方法会创建一个新的签名(获取视图快照及其他签名信息),但不会将其添加到表单。 若要将此签名添加到表单,必须调用 Sign()Signature 类的 方法。

只能从事件的事件处理程序 Sign 调用 方法。

只能由从表单模板打开的表单访问此成员,已使用“表单选项”对话框“安全和信任”类别将该模板配置为以完全信任状态运行。 此成员要求直接调用方的完全信任并且不能由部分信任的代码使用。 有关更多信息,请参阅 MSDN 上的“使用部分信任的代码中的库”。

可以通过 Microsoft InfoPath Filler 中打开的表单中运行的代码访问此类型或成员。

适用于