將單一筆劃的筆劃資料加入至自訂辨識器節點。
命名空間: System.Windows.Ink.AnalysisCore
組件: IACore (在 IACore.dll 中)
語法
'宣告
Public Function AddStrokeToCustomRecognizer ( _
strokeId As Integer, _
strokePacketData As Integer(), _
strokePacketDescription As Guid(), _
customRecognizer As ContextNodeBase _
) As ContextNodeBase
'用途
Dim instance As InkAnalyzerBase
Dim strokeId As Integer
Dim strokePacketData As Integer()
Dim strokePacketDescription As Guid()
Dim customRecognizer As ContextNodeBase
Dim returnValue As ContextNodeBase
returnValue = instance.AddStrokeToCustomRecognizer(strokeId, _
strokePacketData, strokePacketDescription, _
customRecognizer)
public ContextNodeBase AddStrokeToCustomRecognizer(
int strokeId,
int[] strokePacketData,
Guid[] strokePacketDescription,
ContextNodeBase customRecognizer
)
public:
ContextNodeBase^ AddStrokeToCustomRecognizer(
int strokeId,
array<int>^ strokePacketData,
array<Guid>^ strokePacketDescription,
ContextNodeBase^ customRecognizer
)
public ContextNodeBase AddStrokeToCustomRecognizer(
int strokeId,
int[] strokePacketData,
Guid[] strokePacketDescription,
ContextNodeBase customRecognizer
)
public function AddStrokeToCustomRecognizer(
strokeId : int,
strokePacketData : int[],
strokePacketDescription : Guid[],
customRecognizer : ContextNodeBase
) : ContextNodeBase
參數
- strokeId
型別:System.Int32
筆劃識別項。
- strokePacketData
型別:array<System.Int32[]
陣列,包含筆劃的封包資料。
- strokePacketDescription
型別:array<System.Guid[]
陣列,包含封包屬性識別項。
- customRecognizer
型別:System.Windows.Ink.AnalysisCore.ContextNodeBase
要在其中加入筆劃的自訂辨識器節點。
傳回值
型別:System.Windows.Ink.AnalysisCore.ContextNodeBase
筆墨分析器在其中加入筆劃的內容節點。
備註
InkAnalyzerBase 會將筆劃加入至 Type 屬性值為 UnclassifiedInk() 的 ContextNodeBase。
在分析期間,筆墨分析器會將使用中輸入執行緒的文化特性識別項指派至筆劃,並將該筆劃加入至筆墨辨識器下第一個未分類的筆墨節點。如果沒有未分類的節點,則會建立一個。如果自訂辨識器不支援文化特性識別項,則筆墨分析器會繼續分析並產生 AnalysisWarningBase 警告。這個警告的 WarningCode 屬性設為 LanguageIdNotRespected 的 AnalysisWarningCode 值。
strokePacketData 包含筆劃中所有點的封包資料。strokePacketDescription 則包含全域唯一識別項 (GUID),描述筆劃中每個點的封包資料型別。如需完整的可用封包屬性清單,請參閱 PacketProperty 類別。
這個方法會將 DirtyRegion 擴充至區域目前值和所加入筆劃之週框方塊的聯集。
InkAnalyzerBase 會在下列情況下擲回例外狀況。
InkAnalyzerBase 已包含之筆劃的識別項與要加入之筆劃的識別項相同。
customRecognizer 參數包含與不同 InkAnalyzerBase 物件相關聯的 ContextNodeBase。
customRecognizer 參數包含 ContextNodeBase,其 Type 屬性值不是 CustomRecognizer()。
範例
這個範例會定義將 Stroke 轉換成封包資料,並且將筆劃加入至自訂辨識器節點的方法。此方法會傳回筆墨分析器已將筆劃加入其中的 ContextNodeBase。
''' <summary>
''' Adds a stroke to a custom recognizer node.
''' </summary>
''' <param name="baseInkAnalyzer">The ink analyzer that contains the
''' custom recognizer node.</param>
''' <param name="theStroke">The stroke to add.</param>
''' <param name="theCustomRecognizer">The custom recognizer node
''' to which to add the stroke.</param>
''' <returns>The node to which the analyzer added the stroke.</returns>
''' <remarks>
''' This method converts stroke data to packet data for example only.
''' The InkAnalyzerBase is used when your application is handling packet
''' data. If your application uses stroke data from an Ink object, then
''' you would use InkAnalyzer.
''' </remarks>
Public Overloads Shared Function MyAddStrokeToCustomRecognizer( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStroke As Microsoft.Ink.Stroke, _
ByVal theCustomRecognizer As System.Windows.Ink.AnalysisCore.ContextNodeBase) _
As System.Windows.Ink.AnalysisCore.ContextNodeBase
If baseInkAnalyzer Is Nothing Then
Throw New ArgumentNullException("baseInkAnalyzer")
End If
If theStroke Is Nothing Then
Throw New ArgumentNullException("theStroke")
End If
If theCustomRecognizer Is Nothing Then
Throw New ArgumentNullException("theCustomRecognizer")
End If
If System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer <> _
theCustomRecognizer.Type Then
Throw New ArgumentException( _
"The context node is not a custom recognizer node.", _
"theCustomRecognizer")
End If
If baseInkAnalyzer.FindNode(theCustomRecognizer.Id) Is Nothing Then
Throw New ArgumentException( _
"The custom recognizer node is not attached to the ink analyzer.")
End If
Dim result As System.Windows.Ink.AnalysisCore.ContextNodeBase = _
baseInkAnalyzer.AddStrokeToCustomRecognizer(theStroke.Id, _
theStroke.GetPacketData(), theStroke.PacketDescription, _
theCustomRecognizer)
Return result
End Function 'AddStrokeToCustomRecognizer
/// <summary>
/// Adds a stroke to a custom recognizer node.
/// </summary>
/// <param name="baseInkAnalyzer">The ink analyzer that contains the
/// custom recognizer node.</param>
/// <param name="theStroke">The stroke to add.</param>
/// <param name="theCustomRecognizerNode">The custom recognizer node
/// to which to add the stroke.</param>
/// <returns>The node to which the analyzer added the stroke.</returns>
/// <remarks>
/// This method converts stroke data to packet data for example only.
/// The InkAnalyzerBase is used when your application is handling packet
/// data. If your application uses stroke data from an Ink object, then
/// you would use InkAnalyzer.
/// </remarks>
public static System.Windows.Ink.AnalysisCore.ContextNodeBase MyAddStrokeToCustomRecognizer(
System.Windows.Ink.AnalysisCore.InkAnalyzerBase baseInkAnalyzer,
Microsoft.Ink.Stroke theStroke,
System.Windows.Ink.AnalysisCore.ContextNodeBase theCustomRecognizer)
{
if (null == baseInkAnalyzer)
{
throw new ArgumentNullException("baseInkAnalyzer");
}
if (null == theStroke)
{
throw new ArgumentNullException("theStroke");
}
if (null == theCustomRecognizer)
{
throw new ArgumentNullException("theCustomRecognizer");
}
if (System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer
!= theCustomRecognizer.Type)
{
throw new ArgumentException(
"The context node is not a custom recognizer node.",
"theCustomRecognizer");
}
if (null == baseInkAnalyzer.FindNode(theCustomRecognizer.Id))
{
throw new ArgumentException(
"The custom recognizer node is not attached to the ink analyzer.");
}
System.Windows.Ink.AnalysisCore.ContextNodeBase result =
baseInkAnalyzer.AddStrokeToCustomRecognizer(
theStroke.Id, theStroke.GetPacketData(),
theStroke.PacketDescription, theCustomRecognizer);
return result;
}
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0