MatchesCriteriaCallback, délégué
Mise à jour : November 2007
Représente une fonction permettant d'évaluer si un objet ContextNode répond ou non à un critère spécifié.
Espace de noms : Microsoft.Ink
Assembly : Microsoft.Ink.Analysis (dans Microsoft.Ink.Analysis.dll)
Syntaxe
'Déclaration
Public Delegate Function MatchesCriteriaCallback ( _
visitingNode As ContextNode, _
data As Object _
) As Boolean
'Utilisation
Dim instance As New MatchesCriteriaCallback(AddressOf HandlerMethod)
public delegate bool MatchesCriteriaCallback(
ContextNode visitingNode,
Object data
)
public delegate bool MatchesCriteriaCallback(
ContextNode^ visitingNode,
Object^ data
)
/** @delegate */
public delegate boolean MatchesCriteriaCallback(
ContextNode visitingNode,
Object data
)
JScript ne prend pas en charge les délégués.
Paramètres
- visitingNode
Type : Microsoft.Ink.ContextNode
Objet ContextNode qui sera vérifié par rapport au critère.
- data
Type : System.Object
Données facultatives qui peuvent être utilisées en tant que critères.
Valeur de retour
Type : System.Boolean
Si l'objet visitingNode répond au critère.
Exemples
L'exemple suivant recherche la collection d'objets ContextNode dans un InkAnalyzer, theInkAnalyzer, qui répond aux critères spécifiés dans la fonction déléguée LineIsLowerThan de MatchesCriteriaCallBack à l'aide d'un entier, yValue.
Dim lineIsLowerThanCallback As _
New Microsoft.Ink.MatchesCriteriaCallback(AddressOf LineIsLowerThan)
Dim nodesBelowYValue As ContextNodeCollection = _
theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue)
Microsoft.Ink.MatchesCriteriaCallback
lineIsLowerThanCallback = new Microsoft.Ink.MatchesCriteriaCallback(LineIsLowerThan);
ContextNodeCollection nodesBelowYValue =
theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue);
LineIsLowerThan retourne la valeur true si le ContextNode est un LineNode et si le bas du cadre englobant est inférieur à un entier passé (notez que plus la valeur de la coordonnée y est élevée, plus l'affichage à l'écran est bas). Par conséquent, la collection nodesBelowYValue contient toutes les lignes dont les traits sont situés sous la valeur, yValue.
Public Function LineIsLowerThan(ByVal node As Microsoft.Ink.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 Integer = Fix(data)
Return node.Location.GetBounds().Bottom > yValue
End Function 'LineIsLowerThan
public bool LineIsLowerThan(Microsoft.Ink.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
int yValue = (int)data;
return (node.Location.GetBounds().Bottom > yValue);
}
Plateformes
Windows Vista
Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Informations de version
.NET Framework
Pris en charge dans : 3.0