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
ContextNodeBaseCollection ,包含符合所指定準則的所有 ContextNodeBase 物件。
範例
下列範例會使用整數 yValue,在 InkAnalyzerBase (theInkAnalyzerBase) 中尋找符合 MatchesCriteriaBaseCallback 委派 (Delegate) 函式中指定之準則的 LineIsLowerThanContextNodeBase 物件集合。
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