共用方式為


InkAnalyzer.FindNodes 方法 (MatchesCriteriaCallback, Object)

傳回 ContextNodeCollection,其中包含符合所指定準則的所有 ContextNode 物件。

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

語法

'宣告
Public Function FindNodes ( _
    criteria As MatchesCriteriaCallback, _
    data As Object _
) As ContextNodeCollection
'用途
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 ContextNodeCollection FindNodes(
    MatchesCriteriaCallback criteria,
    Object data
)
public function FindNodes(
    criteria : MatchesCriteriaCallback, 
    data : Object
) : ContextNodeCollection

參數

  • data
    型別:System.Object
    可傳入委派函式的其他選擇性資料。這個方法會隨每次呼叫將這項資料傳遞至委派,而且不會進行修改或檢查。

傳回值

型別:System.Windows.Ink.ContextNodeCollection
ContextNodeCollection ,包含符合所指定準則的所有 ContextNode 物件。

範例

下列範例會在名為 theInkAnalyzer 的 InkAnalyzer 中,尋找滿足 LineIsLowerThan 委派中所指定準則的內容節點集合。然後,再將 32 位元帶正負號的整數 yValue 傳遞至 LineIsLowerThan 委派。

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

下列範例會定義 LineIsLowerThan 方法,該方法會在 ContextNodeLineNode 且週框方塊底端低於傳入的整數時傳回 true (請注意,座標表示相對於視窗左上角。越往下移動,Y 座標值越高)。因此,在 nodesBelowYValue 集合包含的所有行中,筆劃都會低於 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);
}

平台

Windows Vista

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

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

InkAnalyzer 類別

InkAnalyzer 成員

FindNodes 多載

System.Windows.Ink 命名空間

InkAnalyzer.FindInkLeafNodes

InkAnalyzer.FindLeafNodes

InkAnalyzer.FindNode

InkAnalyzer.FindNodesOfType