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。
備註
當應用程式基於偵錯目的而繪製某些資訊,並且需要對可能發生變更的區域進行 Invalidate 以便繪製偵錯資訊時,最常使用 AppliedChangesRegion。
範例
下列範例是 ResultsUpdated 事件的事件處理常式。這個事件是在呼叫 BackgroundAnalyze 之後分析完成時呼叫。基於偵錯目的,事件處理常式中的 DrawingAttributes 會在筆劃經過分析時變成紅色。這個範例只會使用 AppliedChangesRegion 更新發生變更的位置,而不會更新整個控制項。這個範例會使用名為 theInkCollector 的 InkCollector,其筆墨位於 Panel (panelForInk)。分析是由 InkAnalyzerBase (名為 theInkAnalyzerBase) 執行。
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