InkAnalyzerBase.FindNodes 方法 (MatchesCriteriaBaseCallback, Object)
返回符合指定条件的所有 ContextNodeBase 对象。
命名空间: System.Windows.Ink.AnalysisCore
程序集: IACore(在 IACore.dll 中)
语法
声明
Public Function FindNodes ( _
criteria As MatchesCriteriaBaseCallback, _
data As Object _
) As ContextNodeBaseCollection
用法
Dim instance As InkAnalyzerBase
Dim criteria As MatchesCriteriaBaseCallback
Dim data As Object
Dim returnValue As ContextNodeBaseCollection
returnValue = instance.FindNodes(criteria, _
data)
public ContextNodeBaseCollection FindNodes(
MatchesCriteriaBaseCallback criteria,
Object data
)
public:
ContextNodeBaseCollection^ FindNodes(
MatchesCriteriaBaseCallback^ criteria,
Object^ data
)
public ContextNodeBaseCollection FindNodes(
MatchesCriteriaBaseCallback criteria,
Object data
)
public function FindNodes(
criteria : MatchesCriteriaBaseCallback,
data : Object
) : ContextNodeBaseCollection
参数
- criteria
类型:System.Windows.Ink.AnalysisCore.MatchesCriteriaBaseCallback
用以确定 ContextNodeBase 对象是否符合其指定条件的委托函数。
- data
类型:System.Object
可传入该委托函数的可选的其他数据。此方法在每次调用中将这些数据传递给该委托,并不修改或检查这些数据。
返回值
类型:System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection
包含符合指定条件的所有 ContextNodeBase 对象的 ContextNodeBaseCollection。
示例
下面的示例在 InkAnalyzerBase (theInkAnalyzerBase) 中查找满足特定条件的 ContextNodeBase 对象的集合,该条件是通过使用整数 yValue 在 MatchesCriteriaBaseCallback 委托函数 LineIsLowerThan 中指定的。
Dim lineIsLowerThanCallback As _
New System.Windows.Ink.AnalysisCore.MatchesCriteriaBaseCallback(AddressOf LineIsLowerThan)
Dim nodesBelowYValue As ContextNodeBaseCollection = _
theInkAnalyzerBase.FindNodes(lineIsLowerThanCallback, yValue)
System.Windows.Ink.AnalysisCore.MatchesCriteriaBaseCallback
lineIsLowerThanCallback = new System.Windows.Ink.AnalysisCore.MatchesCriteriaBaseCallback(LineIsLowerThan);
ContextNodeBaseCollection nodesBelowYValue =
theInkAnalyzerBase.FindNodes(lineIsLowerThanCallback, yValue);
下面的示例定义 LineIsLowerThan 方法,如果 ContextNodeBase 的类型为 Line 且边界框的底部低于传入的整数所指示的位置,则该方法返回 true。请注意,y 值越大,在屏幕上的位置越低。)因此,nodesBelowYValue 集合包含笔画位于 yValue 值所指示的位置之下的所有行。
Public Function LineIsLowerThan( _
ByVal nodeBase As System.Windows.Ink.AnalysisCore.ContextNodeBase, _
ByVal data As Object) As Boolean
' Return false if not a line
If nodeBase.Type <> System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line Then
Return False
End If
' Check if bottom is lower than yValue passed in
Dim yValue As Integer = Fix(data)
Return nodeBase.Location.GetBounds()(3) > yValue
End Function 'LineIsLowerThan
public bool LineIsLowerThan(System.Windows.Ink.AnalysisCore.ContextNodeBase nodeBase, object data)
{
// Return false if not a line
if (!(nodeBase.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line))
return false;
// Check if bottom is lower than yValue passed in
int yValue = (int)data;
return (nodeBase.Location.GetBounds()[3] > yValue);
}
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0