Share via


AnalysisStatus.AppliedChangesRegion Property

Returns the region of the document where the InkAnalyzer has changed the ContextNode tree.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Syntax

'Declaration
Public ReadOnly Property AppliedChangesRegion As AnalysisRegion
'Usage
Dim instance As AnalysisStatus 
Dim value As AnalysisRegion 

value = instance.AppliedChangesRegion
public AnalysisRegion AppliedChangesRegion { get; }
public:
property AnalysisRegion^ AppliedChangesRegion {
    AnalysisRegion^ get ();
}
public function get AppliedChangesRegion () : AnalysisRegion

Property Value

Type: Microsoft.Ink.AnalysisRegion
The AnalysisRegion of the document where changes were updated.

Remarks

AppliedChangesRegion is used when the application needs to Invalidate the area with changes. For example, the application might draw a special tag to click for the user to modify the analysis results.

Examples

The following example is a ResultsUpdated event handler that is called when BackgroundAnalyze completes analysis. In the event handler, for debugging purposes, the DrawingAttributes are changed to red after strokes are analyzed. Rather than updating the entire control, it uses AppliedChangesRegion to update only areas where changes have occurred. The example uses an InkCollector, theInkCollector, which collects ink in a System.Windows.Forms.Panel, panelForInk. An InkAnalyzer, theInkAnalyzer, performs the analysis.

Private Sub theInkAnalyzer_Results(ByVal sender As Object, ByVal e As ResultsUpdatedEventArgs) _
Handles theInkAnalyzer.ResultsUpdated
    Dim status As AnalysisStatus = e.Status

    If status.Successful = True Then 
        ' For debugging purposes, show all analyzed strokes as red 
        Me.theInkAnalyzer.RootNode.Strokes.ModifyDrawingAttributes(New DrawingAttributes(Color.Red))

        ' Invalidate just the changed region 
        Dim panelGraphics As Graphics = Me.panelForInk.CreateGraphics()
        Dim bounds As Rectangle = status.AppliedChangesRegion.GetBounds()
        ' Increase bounds by pen width
        bounds.Inflate(CType(Me.theInkCollector.DefaultDrawingAttributes.Width, Integer), _
           CType(Me.theInkCollector.DefaultDrawingAttributes.Height, Integer))
        Dim corner1 As Point = bounds.Location
        Dim corner2 As Point = New Point(bounds.Right, bounds.Bottom)
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, corner1)
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, corner2)
        bounds = New Rectangle(corner1.X, corner1.Y, corner2.X - corner1.X, _
            corner2.Y - corner1.Y)
        panelGraphics.Dispose()
        panelForInk.Invalidate(bounds)
    End If 
End Sub
void theInkAnalyzer_ResultsUpdated(object sender, ResultsUpdatedEventArgs e)
{
    AnalysisStatus status = e.Status;

    if (status.Successful)
    {
        // For debugging purposes, show all analyzed strokes as red 
        this.theInkAnalyzer.RootNode.Strokes.ModifyDrawingAttributes(new DrawingAttributes(Color.Red));

        // Invalidate just the changed region
        Graphics panelGraphics = this.panelForInk.CreateGraphics();
        Rectangle bounds = status.AppliedChangesRegion.GetBounds();
        // Increase bounds by pen width
        bounds.Inflate((int)this.theInkCollector.DefaultDrawingAttributes.Width,
           (int)this.theInkCollector.DefaultDrawingAttributes.Height);
        Point corner1 = bounds.Location;
        Point corner2 = new Point(bounds.Right, bounds.Bottom);
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, ref corner1);
        theInkCollector.Renderer.InkSpaceToPixel(panelGraphics, ref corner2);
        bounds = new Rectangle(corner1.X, corner1.Y, corner2.X - corner1.X,
            corner2.Y - corner1.Y);
        panelGraphics.Dispose();
        panelForInk.Invalidate(bounds);
    }
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

AnalysisStatus Class

AnalysisStatus Members

Microsoft.Ink Namespace