InkAnalyzer.AddStrokes 方法 (Strokes, Int32)
向 InkAnalyzer 添加笔画集合,并为每个笔画分配特定的区域设置标识符。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.dll 中)
语法
声明
Public Function AddStrokes ( _
strokesToAdd As Strokes, _
languageId As Integer _
) As ContextNode
用法
Dim instance As InkAnalyzer
Dim strokesToAdd As Strokes
Dim languageId As Integer
Dim returnValue As ContextNode
returnValue = instance.AddStrokes(strokesToAdd, _
languageId)
public ContextNode AddStrokes(
Strokes strokesToAdd,
int languageId
)
public:
ContextNode^ AddStrokes(
Strokes^ strokesToAdd,
int languageId
)
public ContextNode AddStrokes(
Strokes strokesToAdd,
int languageId
)
public function AddStrokes(
strokesToAdd : Strokes,
languageId : int
) : ContextNode
参数
- strokesToAdd
类型:Microsoft.Ink.Strokes
要添加到 InkAnalyzer 的 Strokes。
- languageId
类型:System.Int32
要分配给 strokesToAdd 集合中的笔画的语言标识符。
返回值
类型:Microsoft.Ink.ContextNode
已添加 strokesToAdd 的 ContextNode。
备注
InkAnalyzer 将 Strokes 添加到 RootNode 属性的 SubNodes 集合中的一个 UnclassifiedInkNode。Strokes 集合 strokesToAdd 中的每个笔画将被分配区域设置标识符 languageId,并添加到包含具有相同区域设置标识符的笔画的第一个 UnclassifiedInkNode。如果不存在这样的 UnclassifiedInkNode,则新建一个 UnclassifiedInkNode,并将 strokeToAdd 添加到新的 UnclassifiedInkNode 中。
此方法将 DirtyRegion 扩展为区域的当前值与所添加笔画的边界框的并集。
如果这些笔画中有任何笔画已经附加到 InkAnalyzer,则 InkAnalyzer 将引发异常。
示例
此示例执行以下操作。
初始化新的 Microsoft.Ink.Ink 对象 theInk。
将 Ink.InkAdded 事件处理程序 theInk_InkAdded2 附加到 theInk。
初始化新的 InkAnalyzer (theInkAnalyzer),它可以分析来自 theInk 的笔画数据。
' Create the Ink for use with the InkCollector and attach
' event handlers.
Me.theInk = New Microsoft.Ink.Ink()
AddHandler Me.theInk.InkAdded, AddressOf theInk_InkAdded
' Create the InkAnalyzer.
Me.theInkAnalyzer = New Microsoft.Ink.InkAnalyzer(Me.theInk, Me)
// Create the Ink for use with the InkCollector and attach
// event handlers.
this.theInk = new Microsoft.Ink.Ink();
this.theInk.InkAdded +=
new Microsoft.Ink.StrokesEventHandler(theInk_InkAdded);
// Create the InkAnalyzer.
this.theInkAnalyzer =
new Microsoft.Ink.InkAnalyzer(this.theInk, this);
在此示例中,theInk_InkAdded2 事件处理程序随后获取已添加到 theInk 的笔画,将这些笔画添加到 theInkAnalyzer,并为这些笔画分配特定的区域设置标识符 theLanguageId。
''' <summary>
''' The ink's InkAdded event handler.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
Sub theInk_InkAdded2( _
ByVal sender As Object, ByVal e As Microsoft.Ink.StrokesEventArgs)
' This event handler is attached to an Ink object.
Dim theInk As Microsoft.Ink.Ink = DirectCast(sender, Microsoft.Ink.Ink)
' Add the new strokes to the InkAnalyzer using a specific language identifier.
Me.theInkAnalyzer.AddStrokes( _
theInk.CreateStrokes(e.StrokeIds), Me.theLanguageId)
End Sub 'theInk_InkAdded2
/// <summary>
/// The ink's InkAdded event handler.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
void theInk_InkAdded2(object sender, Microsoft.Ink.StrokesEventArgs e)
{
// This event handler is attached to an Ink object.
Microsoft.Ink.Ink theInk = sender as Microsoft.Ink.Ink;
// Add the new strokes to the InkAnalyzer using a specific
// language identifier.
this.theInkAnalyzer.AddStrokes(
theInk.CreateStrokes(e.StrokeIds), this.theLanguageId);
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0