Поделиться через


AnalysisStatus.AppliedChangesRegion - свойство

Обновлен: Ноябрь 2007

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

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink.Analysis (в Microsoft.Ink.Analysis.dll)

Синтаксис

'Декларация
Public ReadOnly Property AppliedChangesRegion As AnalysisRegion
'Применение
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

Значение свойства

Тип: Microsoft.Ink.AnalysisRegion
The AnalysisRegion of the document where changes were updated.

Заметки

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.

Примеры

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);
    }
}

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

AnalysisStatus Класс

AnalysisStatus - члены

Microsoft.Ink - пространство имен