共用方式為


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

將單一筆劃的筆劃資料加入至筆墨分析器,並且將特定文化特性識別項指派給筆劃。

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

語法

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

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

參數

  • strokePacketData
    型別:array<System.Int32[]
    陣列,包含筆劃的封包資料。
  • strokePacketDescription
    型別:array<System.Guid[]
    陣列,包含封包屬性識別項。
  • languageId
    型別:System.Int32
    要指派給筆劃的文化特性識別項。

傳回值

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

備註

InkAnalyzerBase 會將筆劃加入至 Type 屬性值為 UnclassifiedInk() 的 ContextNodeBase

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

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

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

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

範例

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

''' <summary>
''' Adds a stroke to an InkAnalyzerBase and assigns a specific
''' culture identifier to the stroke.
''' </summary>
''' <param name="baseInkAnalyzer">
''' The analyzer that receives the stroke.</param>
''' <param name="theStroke">The stroke to add.</param>
''' <param name="languageIdentifier">The culture identifier to assign to
''' 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 MyAddStroke( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStroke As Microsoft.Ink.Stroke, _
ByVal languageIdentifier As Integer) _
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 and specify the
    ' stroke's language.
    Dim result As System.Windows.Ink.AnalysisCore.ContextNodeBase = _
        baseInkAnalyzer.AddStroke(theStroke.Id, _
            theStroke.GetPacketData(), theStroke.PacketDescription, _
            languageIdentifier)

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

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

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

    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