次の方法で共有


AnalysisStatusBase.AppliedChangesRegion プロパティ

InkAnalyzer.Analyze または InkAnalyzerBase.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 にインクが存在する、theInkCollector という名前の InkCollector を使用します。この分析は、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