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 ();
}
/** @property */
public AnalysisRegion get_AppliedChangesRegion ()
public function get AppliedChangesRegion () : AnalysisRegion
Not applicable.
Property Value
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.
Example
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.PanelSystem.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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Version Information
.NET Framework
Supported in: 3.0
See Also
Reference
AnalysisStatus Class
AnalysisStatus Members
Microsoft.Ink Namespace