InkAnalyzer.PopulateContextNode 事件

InkAnalyzer 在部分填充的 ContextNode 的区域中执行分析之前发生。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.dll 中)

语法

声明
Public Event PopulateContextNode As PopulateContextNodeEventHandler
用法
Dim instance As InkAnalyzer
Dim handler As PopulateContextNodeEventHandler

AddHandler instance.PopulateContextNode, handler
public event PopulateContextNodeEventHandler PopulateContextNode
public:
 event PopulateContextNodeEventHandler^ PopulateContextNode {
    void add (PopulateContextNodeEventHandler^ value);
    void remove (PopulateContextNodeEventHandler^ value);
}
/** @event */
public void add_PopulateContextNode (PopulateContextNodeEventHandler value)
/** @event */
public void remove_PopulateContextNode (PopulateContextNodeEventHandler value)
JScript 不支持事件。

备注

如果您的应用程序维护其自己的数据结构(该数据结构与 InkAnalyzer 的数据结构同步),请使用此事件。当 InkAnalyzer 引发此事件时,应用程序应填充 PopulateContextNodeEventArgs.NodeToPopulate。在分析阶段中,InkAnalyzer 引发此事件以获取有关在其中分析墨迹的区域的信息。

如果文档中包含 NodeToPopulate 的链接,则应用程序应创建并添加这些链接。此过程要求在此事件的事件处理程序存在之前,源节点和目标节点以及这些节点的上级节点都必须完全填充。

有关将应用程序数据与 InkAnalyzer 同步的更多信息,请参见Data Proxy with Ink Analysis

在后台分析过程中,InkAnalyzer 在引发 InkAnalyzerStateChanging 事件之后引发此事件。

示例

此示例定义 AttachDataProxyEventHandlers 方法,该方法将数据代理事件处理程序附加到一个 InkAnalyzer (theInkAnalyzer)。

Private Sub AttachDataProxyEventHandlers() 
    ' If the document model supports on demand data proxy, then add an
    ' event handler for the PopulateContextNode event. This event is raised
    ' when the InkAnalyzer accesses a partially populated ContextNode created
    ' by the document model.
    If Me.theDocumentModel.SupportsOnDemandDataProxy Then
        AddHandler Me.theInkAnalyzer.PopulateContextNode, AddressOf Me.PopulateContextNode
    End If

    ' Add the other data proxy related event handlers. These events are raised
    ' by the InkAnalyzer to communicate ink analysis results to the document model.
    AddHandler Me.theInkAnalyzer.ContextNodeCreated, AddressOf Me.AddContextNode
    AddHandler Me.theInkAnalyzer.ContextNodeDeleting, AddressOf Me.RemoveContextNode
    AddHandler Me.theInkAnalyzer.ContextNodeLinkAdding, AddressOf Me.AddContextNodeLink
    AddHandler Me.theInkAnalyzer.ContextNodeLinkDeleting, AddressOf Me.RemoveContextNodeLink
    AddHandler Me.theInkAnalyzer.ContextNodeMovingToPosition, AddressOf Me.MoveContextNodeToPosition
    AddHandler Me.theInkAnalyzer.ContextNodePropertiesUpdated, AddressOf Me.UpdateContextNodeProperties
    AddHandler Me.theInkAnalyzer.ContextNodeReparenting, AddressOf Me.ReparentContextNode
    AddHandler Me.theInkAnalyzer.InkAnalyzerStateChanging, AddressOf Me.InkAnalyzer_StateChanging
    AddHandler Me.theInkAnalyzer.StrokesReparented, AddressOf Me.ReparentStroke
    AddHandler Me.theInkAnalyzer.IntermediateResultsUpdated, AddressOf Me.ResultsAvailable
    AddHandler Me.theInkAnalyzer.ResultsUpdated, AddressOf Me.ResultsAvailable

End Sub 'AttachDataProxyEventHandlers
        private void AttachDataProxyEventHandlers()
        {
            // If the document model supports on demand data proxy, then add an
            // event handler for the PopulateContextNode event. This event is raised
            // when the InkAnalyzer accesses a partially populated ContextNode created
            // by the document model.
            if (this.theDocumentModel.SupportsOnDemandDataProxy)
            {
                this.theInkAnalyzer.PopulateContextNode +=
                    new Microsoft.Ink.PopulateContextNodeEventHandler(
                        this.PopulateContextNode);
            }

            // Add the other data proxy related event handlers. These events are raised
            // by the InkAnalyzer to communicate ink analysis results to the document model.
            this.theInkAnalyzer.ContextNodeCreated +=
                new Microsoft.Ink.ContextNodeCreatedEventHandler(
                    this.AddContextNode);
            this.theInkAnalyzer.ContextNodeDeleting +=
                new Microsoft.Ink.ContextNodeDeletingEventHandler(
                    this.RemoveContextNode);
            this.theInkAnalyzer.ContextNodeLinkAdding +=
                new Microsoft.Ink.ContextNodeLinkAddingEventHandler(
                    this.AddContextNodeLink);
            this.theInkAnalyzer.ContextNodeLinkDeleting +=
                new Microsoft.Ink.ContextNodeLinkDeletingEventHandler(
                    this.RemoveContextNodeLink);
            this.theInkAnalyzer.ContextNodeMovingToPosition +=
                new Microsoft.Ink.ContextNodeMovingToPositionEventHandler(
                    this.MoveContextNodeToPosition);
            this.theInkAnalyzer.ContextNodePropertiesUpdated +=
                new Microsoft.Ink.ContextNodePropertiesUpdatedEventHandler(
                    this.UpdateContextNodeProperties);
            this.theInkAnalyzer.ContextNodeReparenting +=
                new Microsoft.Ink.ContextNodeReparentingEventHandler(
                    this.ReparentContextNode);
            this.theInkAnalyzer.InkAnalyzerStateChanging +=
                new Microsoft.Ink.InkAnalyzerStateChangingEventHandler(
                    this.InkAnalyzer_StateChanging);
            this.theInkAnalyzer.StrokesReparented +=
                new Microsoft.Ink.StrokesReparentedEventHandler(
                    this.ReparentStrokes);
            this.theInkAnalyzer.IntermediateResultsUpdated +=
                new Microsoft.Ink.ResultsUpdatedEventHandler(
                    this.ResultsAvailable);
            this.theInkAnalyzer.ResultsUpdated +=
                new Microsoft.Ink.ResultsUpdatedEventHandler(
                    this.ResultsAvailable);
        }

下面的示例定义 PopulateContextNode 方法,用以处理 PopulateContextNode 事件。事件信息将传递给文档模型对象 theDocumentModel。

此示例不提供文档模型的定义,也不演示文档模型如何处理传入的信息。

'/ <summary>
'/ Handles the InkAnalyzer.PopulateContextNode event.
'/ </summary>
'/ <param name="sender">The source of the event.</param>
'/ <param name="e">The event data.</param>
'/ <remarks>
'/ This event handler fully populates a ContextNode from the document model.
'/ The InkAnalyzer calls this event handler when it accesses a partially
'/ populated ContextNode created by the document model.
'/ </remarks>
Private Sub PopulateContextNode( _
    ByVal sender As Object, _
    ByVal e As Microsoft.Ink.PopulateContextNodeEventArgs)

    Me.theDocumentModel.PopulateNode(e.NodeToPopulate, _
        CType(sender, Microsoft.Ink.InkAnalyzer))

End Sub 'PopulateContextNode

        /// <summary>
        /// Handles the InkAnalyzer.PopulateContextNode event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The event data.</param>
        /// <remarks>
        /// This event handler fully populates a ContextNode from the document model.
        /// The InkAnalyzer calls this event handler when it accesses a partially
        /// populated ContextNode created by the document model.
        /// </remarks>
        private void PopulateContextNode(
            object sender, Microsoft.Ink.PopulateContextNodeEventArgs e)
        {
            this.theDocumentModel.PopulateNode(
                e.NodeToPopulate, (Microsoft.Ink.InkAnalyzer)sender);
        }

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzer 类

InkAnalyzer 成员

Microsoft.Ink 命名空间

Microsoft.Ink.ContextNode

Microsoft.Ink.ContextLink

InkAnalyzer.ReadyToReconcile

Microsoft.Ink.PopulateContextNodeEventArgs