InkAnalyzer.AddStrokes 方法 (StrokeCollection)
將指定的 StrokeCollection 加入至 InkAnalyzer,並且將使用中輸入執行緒的地區設定識別項指派給每個筆劃。
命名空間: System.Windows.Ink
組件: IAWinFX (在 IAWinFX.dll 中)
語法
'宣告
Public Function AddStrokes ( _
strokesToAdd As StrokeCollection _
) As ContextNode
'用途
Dim instance As InkAnalyzer
Dim strokesToAdd As StrokeCollection
Dim returnValue As ContextNode
returnValue = instance.AddStrokes(strokesToAdd)
public ContextNode AddStrokes(
StrokeCollection strokesToAdd
)
public:
ContextNode^ AddStrokes(
StrokeCollection^ strokesToAdd
)
public ContextNode AddStrokes(
StrokeCollection strokesToAdd
)
public function AddStrokes(
strokesToAdd : StrokeCollection
) : ContextNode
參數
- strokesToAdd
型別:System.Windows.Ink.StrokeCollection
要加入至 InkAnalyzer 的 StrokeCollection。
傳回值
型別:System.Windows.Ink.ContextNode
其中已加入 strokesToAdd 的 ContextNode。
備註
InkAnalyzer 會將 StrokeCollection 加入至 RootNode 屬性之 SubNodes 集合中的 UnclassifiedInkNode。StrokeCollection 集合 strokesToAdd 中的每個筆劃都會收到指派給使用中輸入執行緒的地區設定識別項。集合中的每個筆劃也會加入至包含相同地區設定識別項之筆劃的第一個 UnclassifiedInkNode。如果沒有這類 UnclassifiedInkNode,則會建立新的 UnclassifiedInkNode,並且將 strokesToAdd 加入至新的 UnclassifiedInkNode。
這個方法會將 DirtyRegion 擴充至區域之目前值和所加入筆劃之週框方塊的聯集。
如果任何筆劃已附加至 InkAnalyzer,則 InkAnalyzer 會擲回例外狀況。
範例
下列範例會建立新的 InkAnalyzer,並且將 StrokesChanged 事件處理常式附加至 InkCanvas (名為 theInkCanvas) 上的 Strokes 屬性。
theInkAnalyzer = New InkAnalyzer()
AddHandler theInkCanvas.Strokes.StrokesChanged, AddressOf Strokes_StrokesChanged
theInkAnalyzer = new InkAnalyzer();
theInkCanvas.Strokes.StrokesChanged +=
new StrokeCollectionChangedEventHandler(Strokes_StrokesChanged);
下列範例會定義 Strokes_StrokesChanged 事件處理常式。如果筆劃已加入至 theInkCanvas,這個事件處理常式會將這些筆劃加入至 theInkAnalyzer。如果筆劃已從 theInkCanvas 移除,它也會將筆劃從 theInkAnalyzer 移除。
' This event occurs whenever a stroke is added, removed, or partially erased
' from the InkCanvas.
Sub Strokes_StrokesChanged(ByVal sender As Object, ByVal e As StrokeCollectionChangedEventArgs)
If e.Added.Count > 0 Then
theInkAnalyzer.AddStrokes(e.Added)
End If
If e.Removed.Count > 0 Then
theInkAnalyzer.RemoveStrokes(e.Removed)
End If
End Sub 'Strokes_StrokesChanged
// This event occurs whenever a stroke is added, removed, or partially erased
// from the InkCanvas.
void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
{
if (e.Added.Count > 0)
{
theInkAnalyzer.AddStrokes(e.Added);
}
if (e.Removed.Count > 0)
{
theInkAnalyzer.RemoveStrokes(e.Removed);
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0
請參閱
參考
InkAnalyzerRemoveStroke()
InkAnalyzerRemoveStrokes()