共用方式為


InkAnalyzerBase.AddStroke 方法 (Int32, array<Int32[], array<Guid[])

將單一筆劃的筆劃資料加入至筆墨分析器,並且將使用中輸入執行緒的文化特性 (Culture) 識別項指派給筆劃。

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

語法

'宣告
Public Function AddStroke ( _
    strokeId As Integer, _
    strokePacketData As Integer(), _
    strokePacketDescription As Guid() _
) As ContextNodeBase
'用途
Dim instance As InkAnalyzerBase
Dim strokeId As Integer
Dim strokePacketData As Integer()
Dim strokePacketDescription As Guid()
Dim returnValue As ContextNodeBase

returnValue = instance.AddStroke(strokeId, _
    strokePacketData, strokePacketDescription)
public ContextNodeBase AddStroke(
    int strokeId,
    int[] strokePacketData,
    Guid[] strokePacketDescription
)
public:
ContextNodeBase^ AddStroke(
    int strokeId, 
    array<int>^ strokePacketData, 
    array<Guid>^ strokePacketDescription
)
public ContextNodeBase AddStroke(
    int strokeId,
    int[] strokePacketData,
    Guid[] strokePacketDescription
)
public function AddStroke(
    strokeId : int, 
    strokePacketData : int[], 
    strokePacketDescription : Guid[]
) : ContextNodeBase

參數

  • strokePacketData
    型別:array<System.Int32[]
    陣列,包含筆劃的封包資料。
  • strokePacketDescription
    型別:array<System.Guid[]
    陣列,包含封包屬性識別項。

傳回值

型別:System.Windows.Ink.AnalysisCore.ContextNodeBase
筆墨分析器在其中加入筆劃的內容節點。

備註

InkAnalyzerBase 會將筆劃加入至 Type 屬性值為 UnclassifiedInkContextNodeBase

筆墨分析器會將使用中輸入執行緒的文化特性識別項指派至筆劃,並將該筆劃加入至筆墨分析器之根節點 (包含具有相同文化特性識別項的筆劃) 下的第一個未分類的筆墨節點。如果筆墨分析器找不到具有相同文化特性識別項的節點,則會在其根節點下建立新的 ContextNodeBase,並且將筆劃加入至新的未分類筆墨節點。

strokePacketData 包含筆劃中所有點的封包資料。strokePacketDescription 則包含全域唯一識別項 (GUID),描述筆劃中每個點的封包資料型別。如需完整的可用封包屬性清單,請參閱 PacketProperty 類別。

這個方法會將 DirtyRegion 擴充至區域目前值和所加入筆劃之週框方塊的聯集。

如果 InkAnalyzerBase 已經包含具有相同識別項的筆劃,則 InkAnalyzerBase 會擲回例外狀況 (Exception)。

範例

這個範例會定義將 Stroke 轉換成封包資料,並且將筆劃資料加入至 InkAnalyzerBase 的方法。此方法會傳回筆墨分析器已將筆劃加入其中的 ContextNodeBase

''' <summary>
''' Adds a stroke to an InkAnalyzerBase.
''' </summary>
''' <param name="baseInkAnalyzer">
''' The analyzer that receives the stroke.</param>
''' <param name="theStroke">The stroke to add.</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 MyAddStroke( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStroke As Microsoft.Ink.Stroke) _
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

    ' Add a single stroke to the InkAnalyzerBase.
    Dim result As System.Windows.Ink.AnalysisCore.ContextNodeBase = _
        baseInkAnalyzer.AddStroke(theStroke.Id, _
            theStroke.GetPacketData(), theStroke.PacketDescription)

    Return result
End Function 'AddStroke
/// <summary>
/// Adds a stroke to an InkAnalyzerBase.
/// </summary>
/// <param name="baseInkAnalyzer">
/// The analyzer that receives the stroke.</param>
/// <param name="theStroke">The stroke to add.</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 MyAddStroke(
System.Windows.Ink.AnalysisCore.InkAnalyzerBase baseInkAnalyzer,
Microsoft.Ink.Stroke theStroke)
{
    if (null == baseInkAnalyzer)
    {
        throw new ArgumentNullException("baseInkAnalyzer");
    }

    if (null == theStroke)
    {
        throw new ArgumentNullException("theStroke");
    }

    // Add a single stroke to the InkAnalyzerBase.
    System.Windows.Ink.AnalysisCore.ContextNodeBase result = baseInkAnalyzer.AddStroke(
        theStroke.Id, theStroke.GetPacketData(),
        theStroke.PacketDescription);

    return result;
}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

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

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

InkAnalyzerBase 類別

InkAnalyzerBase 成員

AddStroke 多載

System.Windows.Ink.AnalysisCore 命名空間

InkAnalyzerBase.AddStrokes

InkAnalyzerBase.RemoveStroke

InkAnalyzerBase.RemoveStrokes