InkAnalyzer.FindNodes Method (MatchesCriteriaCallback, Object)
Returns a ContextNodeCollection that contains all of the ContextNode objects that match the specified criteria.
Namespace: System.Windows.Ink
Assembly: IAWinFX (in IAWinFX.dll)
Syntax
'Declaration
Public Function FindNodes ( _
criteria As MatchesCriteriaCallback, _
data As Object _
) As ContextNodeCollection
'Usage
Dim instance As InkAnalyzer
Dim criteria As MatchesCriteriaCallback
Dim data As Object
Dim returnValue As ContextNodeCollection
returnValue = instance.FindNodes(criteria, _
data)
public ContextNodeCollection FindNodes(
MatchesCriteriaCallback criteria,
Object data
)
public:
ContextNodeCollection^ FindNodes(
MatchesCriteriaCallback^ criteria,
Object^ data
)
public function FindNodes(
criteria : MatchesCriteriaCallback,
data : Object
) : ContextNodeCollection
Parameters
criteria
Type: System.Windows.Ink.MatchesCriteriaCallbackA delegate function that determines if a ContextNode object meets or fails its specified criteria.
data
Type: System.ObjectOptional extra data that may be passed into the delegate function. This method passes this data to the delegate with each call and does not modify or examine it.
Return Value
Type: System.Windows.Ink.ContextNodeCollection
A ContextNodeCollection containing all of the ContextNode objects that match the specified criteria.
Examples
The following example finds the collection of context nodes in the InkAnalyzer named theInkAnalyzer that satisfy the criteria specified in the LineIsLowerThan delegate. The 32-bit signed integer, yValue, is passed to the LineIsLowerThan delegate.
Dim lineIsLowerThanCallback As New MatchesCriteriaCallback(AddressOf LineIsLowerThan)
Dim nodesBelowYValue As ContextNodeCollection = theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue)
MatchesCriteriaCallback
lineIsLowerThanCallback = new MatchesCriteriaCallback(LineIsLowerThan);
ContextNodeCollection nodesBelowYValue =
theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue);
The following example defines the LineIsLowerThan method, which returns true if the ContextNode is a LineNode and if the bottom of the bounding box is lower than the integer that is passed in. (Note that coordinates are expressed in relation to the top left corner of the window. The more you move down, the higher the y-coordinate is.) Therefore, the nodesBelowYValue collection contains all lines with strokes below the value, yValue.
Public Function LineIsLowerThan(ByVal node As ContextNode, ByVal data As Object) As Boolean
' Return false if not a line
If Not TypeOf node Is LineNode Then
Return False
End If
' Check if bottom is lower than yValue passed in
Dim yValue As Double = System.Convert.ToDouble(data)
Return node.Location.GetBounds().Bottom > yValue
End Function 'LineIsLowerThan
public bool LineIsLowerThan(ContextNode node, object data)
{
// Return false if not a line
if (!(node is LineNode))
return false;
// Check if bottom is lower than yValue passed in
double yValue = (double)data;
return (node.Location.GetBounds().Bottom > yValue);
}
Platforms
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Framework
Supported in: 3.0