AnalysisStatusBase.AppliedChangesRegion 属性

返回对应于在上下文节点树中所做的更改的文档区域作为调用 InkAnalyzer.AnalyzeInkAnalyzerBase.BackgroundAnalyze 的结果。

命名空间:  System.Windows.Ink.AnalysisCore
程序集:  IACore(在 IACore.dll 中)

语法

声明
Public ReadOnly Property AppliedChangesRegion As AnalysisRegionBase
用法
Dim instance As AnalysisStatusBase
Dim value As AnalysisRegionBase

value = instance.AppliedChangesRegion
public AnalysisRegionBase AppliedChangesRegion { get; }
public:
property AnalysisRegionBase^ AppliedChangesRegion {
    AnalysisRegionBase^ get ();
}
/** @property */
public AnalysisRegionBase get_AppliedChangesRegion()
public function get AppliedChangesRegion () : AnalysisRegionBase

属性值

类型:System.Windows.Ink.AnalysisCore.AnalysisRegionBase
文档中应用了更改的 AnalysisRegionBase

备注

AppliedChangesRegion 最常用于以下情况:应用程序已绘制某些信息用于调试,并需要对会发生更改的区域执行 Invalidate 以便绘制调试信息。

示例

下面的示例为 ResultsUpdated 事件的事件处理程序。当调用 BackgroundAnalyze 之后分析完成时将调用此事件。出于调试目的,在该事件处理程序中,DrawingAttributes 在分析笔画之后更改为红色。该示例不更新整个控件,只是使用 AppliedChangesRegion 更新更改过的区域。该示例使用在 Panel(名为 panelForInk)中收集墨迹的 InkCollector(名为 theInkCollector)。分析由名为 theInkAnalyzerBase 的 InkAnalyzerBase 执行。

Private Sub theInkAnalyzer_Results(ByVal sender As Object, ByVal e As ResultsUpdatedBaseEventArgs) _
Handles theInkAnalyzerBase.ResultsUpdatedBase

    Dim status As AnalysisStatusBase = e.Status

    If status.Successful = True Then
        ' For debugging purposes, show all analyzed strokes as red
        Dim analyzedStrokes As Strokes = Me.theInkCollector.Ink.CreateStrokes( _
                    Me.theInkAnalyzerBase.RootNode.GetStrokeIds())

        analyzedStrokes.ModifyDrawingAttributes(New DrawingAttributes(Color.Red))

        ' Invalidate just the changed region
        Dim panelGraphics As Graphics = Me.panelForInk.CreateGraphics()
        Dim bounds() As Integer = status.AppliedChangesRegion.GetBounds()

        ' Increase bounds by pen width
        ' Increase bounds by pen width
        bounds(1) -= CType(Me.theInkCollector.DefaultDrawingAttributes.Width, Integer)
        bounds(2) -= CType(Me.theInkCollector.DefaultDrawingAttributes.Height, Integer)
        bounds(3) += CType(Me.theInkCollector.DefaultDrawingAttributes.Width, Integer)
        bounds(4) += CType(Me.theInkCollector.DefaultDrawingAttributes.Height, Integer)

        Dim corner1 As Point = New Point(bounds(1), bounds(2))
        Dim corner2 As Point = New Point(bounds(3), bounds(3))
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, corner1)
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, corner2)
        Dim newBounds As New Rectangle(corner1.X, corner1.Y, corner2.X - corner1.X, _
            corner2.Y - corner1.Y)
        panelGraphics.Dispose()
        panelForInk.Invalidate(newBounds)
    End If
End Sub
void theInkAnalyzer_Results(object sender, ResultsUpdatedBaseEventArgs e)
{
    AnalysisStatusBase status = e.Status;

    if (status.Successful)
    {
        // For debugging purposes, show all analyzed strokes as red
        Strokes analyzedStrokes = 
            this.theInkCollector.Ink.CreateStrokes(theInkAnalyzerBase.RootNode.GetStrokeIds());

        analyzedStrokes.ModifyDrawingAttributes(new DrawingAttributes(Color.Red));

        // Invalidate just the changed region
        Graphics panelGraphics = this.panelForInk.CreateGraphics();
        int[] bounds = status.AppliedChangesRegion.GetBounds();

        // Increase bounds by pen width
        bounds[0] -= (int)this.theInkCollector.DefaultDrawingAttributes.Width;
        bounds[1] -= (int)this.theInkCollector.DefaultDrawingAttributes.Height;
        bounds[3] += (int)this.theInkCollector.DefaultDrawingAttributes.Width;
        bounds[4] += (int)this.theInkCollector.DefaultDrawingAttributes.Height;

        Point corner1 = new Point(bounds[0], bounds[1]);
        Point corner2 = new Point(bounds[2], bounds[3]);
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, ref corner1);
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, ref corner2);
        Rectangle newBounds = new Rectangle(corner1.X, corner1.Y, corner2.X - corner1.X,
            corner2.Y - corner1.Y);
        panelGraphics.Dispose();
        panelForInk.Invalidate(newBounds);
    }
}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

AnalysisStatusBase 类

AnalysisStatusBase 成员

System.Windows.Ink.AnalysisCore 命名空间

InkAnalyzer.Analyze

InkAnalyzerBase.BackgroundAnalyze