InkAnalyzer.AddStroke 方法 (Stroke)
將 Stroke 加入至 InkAnalyzer,並且將使用中輸入執行緒的地區設定識別項指派給筆劃。
命名空間: Microsoft.Ink
組件: Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)
語法
'宣告
Public Function AddStroke ( _
strokeToAdd As Stroke _
) As ContextNode
'用途
Dim instance As InkAnalyzer
Dim strokeToAdd As Stroke
Dim returnValue As ContextNode
returnValue = instance.AddStroke(strokeToAdd)
public ContextNode AddStroke(
Stroke strokeToAdd
)
public:
ContextNode^ AddStroke(
Stroke^ strokeToAdd
)
public ContextNode AddStroke(
Stroke strokeToAdd
)
public function AddStroke(
strokeToAdd : Stroke
) : ContextNode
參數
- strokeToAdd
型別:Microsoft.Ink.Stroke
要新增至 InkAnalyzer 的 Stroke。
傳回值
型別:Microsoft.Ink.ContextNode
其中加入 strokeToAdd 的 ContextNode。
備註
InkAnalyzer 會將 Stroke 加入至 RootNode 屬性之 SubNodes 集合中的 UnclassifiedInkNode。Stroke (strokeToAdd) 會指派給使用中輸入執行緒的地區設定識別項,並且加入至包含相同地區設定識別項之筆劃的 UnclassifiedInkNode。如果沒有這類 UnclassifiedInkNode,則會建立新的 UnclassifiedInkNode 並會將 strokeToAdd 加入至新 UnclassifiedInkNode。
這個方法會將 DirtyRegion 擴充至區域目前值和所加入筆劃週框的聯集。
如果筆劃已附加至 InkAnalyzer,則 InkAnalyzer 會擲回例外狀況。
範例
這個範例會執行下列操作:
初始化新的 Microsoft.Ink.InkCollector 物件 (theInkCollector)。
將 InkCollector.Stroke 事件處理常式 (theInkCollector_Stroke) 附加至 theInkCollector。
初始化新的 InkAnalyzer (theInkAnalyzer),可分析來自 InkCollector 物件之 Ink 的筆劃資料。
' Create and enable the InkCollector and attach event handlers.
Me.theInkCollector = New Microsoft.Ink.InkCollector(Me.theInkingPanel)
AddHandler Me.theInkCollector.Stroke, AddressOf Me.theInkCollector_Stroke
Me.theInkCollector.Enabled = True
' Create the InkAnalyzer.
Me.theInkAnalyzer = New Microsoft.Ink.InkAnalyzer(Me.theInkCollector.Ink, Me)
// Create and enable the InkCollector and attach event handlers.
this.theInkCollector =
new Microsoft.Ink.InkCollector(this.theInkingPanel);
this.theInkCollector.Stroke +=
new Microsoft.Ink.InkCollectorStrokeEventHandler(
this.theInkCollector_Stroke);
this.theInkCollector.Enabled = true;
// Create the InkAnalyzer.
this.theInkAnalyzer =
new Microsoft.Ink.InkAnalyzer(this.theInkCollector.Ink, this);
在這個範例中,theInkCollector_Stroke 事件處理常式接著會取得已加入至 theInkCollector 的筆劃,並且將它加入至 theInkAnalyzer。
''' <summary>
''' The ink collector's InkAdded event handler.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
Sub theInkCollector_Stroke( _
ByVal sender As Object, ByVal e As Microsoft.Ink.InkCollectorStrokeEventArgs)
' Add the new stroke to the InkAnalyzer.
Me.theInkAnalyzer.AddStroke(e.Stroke)
End Sub 'theInkCollector_Stroke
/// <summary>
/// The ink collector's Stroke event handler.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
void theInkCollector_Stroke(
object sender, Microsoft.Ink.InkCollectorStrokeEventArgs e)
{
// Add the new stroke to the InkAnalyzer.
this.theInkAnalyzer.AddStroke(e.Stroke);
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0