AnalysisStatus.AppliedChangesRegion 属性
返回 InkAnalyzer 更改了 ContextNode 树的文档区域。
命名空间: 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
更新了更改的文档的 AnalysisRegion。
备注
当应用程序需要使更改过的区域 Invalidate(无效)时,可使用 AppliedChangesRegion。例如,应用程序可能绘制一个特殊标记供用户单击,以便修改分析结果。
示例
下面的示例是一个 ResultsUpdated 事件处理程序,BackgroundAnalyze 完成分析时调用该事件处理程序。在该事件处理程序中,出于调试目的,DrawingAttributes 在分析笔画之后更改为红色。它使用 AppliedChangesRegion 只更新更改过的区域,而不是更新整个控件。示例使用 InkCollector 的 theInkCollector 在 System.Windows.Forms.Panel 的 panelForInk 中收集墨迹。InkAnalyzer 的 theInkAnalyzer 执行分析。
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