共用方式為


MatchesCriteriaCallback 委派

表示用來評估 ContextNode 物件是否符合指定之準則的函式。

命名空間:  System.Windows.Ink
組件:  IAWinFX (在 IAWinFX.dll 中)

語法

'宣告
Public Delegate Function MatchesCriteriaCallback ( _
    visitingNode As ContextNode, _
    data As Object _
) As Boolean
'用途
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 不支援委派。

參數

  • data
    型別:System.Object
    可用於準則的選擇性資料。

傳回值

型別:System.Boolean
如果 visitingNode 符合準則,則為 true,否則為 false。

範例

下列範例會使用整數值 yValue,在 InkAnalyzer (theInkAnalyzer) 中尋找符合 MatchesCriteriaCallBack 委派 (Delegate) 函式 (LineIsLowerThan) 中指定之準則的 ContextNode 物件集合。

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);

如果 ContextNodeLineNode 且週框方塊底端低於傳入的整數時,LineIsLowerThan 會傳回 true。因此 nodesBelowYValue 集合包含的所有行中,筆劃都會低於 yValue 值。請記住,Y 值愈高,其在螢幕上出現的位置就愈低。

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);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

System.Windows.Ink 命名空間

InkAnalyzer.FindNodes