InkAnalyzer.GetStrokeLanguageId 方法
返回指定 Stroke 的区域设置标识符。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.dll 中)
语法
声明
Public Function GetStrokeLanguageId ( _
stroke As Stroke _
) As Integer
用法
Dim instance As InkAnalyzer
Dim stroke As Stroke
Dim returnValue As Integer
returnValue = instance.GetStrokeLanguageId(stroke)
public int GetStrokeLanguageId(
Stroke stroke
)
public:
int GetStrokeLanguageId(
Stroke^ stroke
)
public int GetStrokeLanguageId(
Stroke stroke
)
public function GetStrokeLanguageId(
stroke : Stroke
) : int
参数
- stroke
类型:Microsoft.Ink.Stroke
要为其返回区域设置标识符的笔画。
返回值
类型:System.Int32
stroke 的区域设置标识符。
备注
笔画的区域设置是在通过调用 AddStroke 或 AddStrokes 添加笔画时设置的。若要更改笔画的区域设置,请调用 InkAnalyzer.SetStrokeLanguageId。
示例
此示例定义 GetLanguagesInNode 方法,用以返回 ContextNode 中的笔画的所有区域设置标识符。
''' <summary>
''' Returns the locale identifiers for all the strokes in the node.
''' </summary>
''' <param name="theInkAnalyzer">The ink analyzer containing the node.</param>
''' <param name="theContextNode">The node to check.</param>
''' <returns>An array of unique locale identifiers.</returns>
Private Function GetLanguagesInNode( _
ByVal theInkAnalyzer As Microsoft.Ink.InkAnalyzer, _
ByVal theContextNode As Microsoft.Ink.ContextNode) As Integer()
' Iterate through the strokes within the context node and add the locale
' identifiers to a collection.
Dim theLanguages As New System.Collections.ArrayList()
Dim theStroke As Microsoft.Ink.Stroke
For Each theStroke In theContextNode.Strokes
Dim theStrokeLanguage As Integer = _
theInkAnalyzer.GetStrokeLanguageId(theStroke)
If Not theLanguages.Contains(theStrokeLanguage) Then
theLanguages.Add(theStrokeLanguage)
End If
Next theStroke
' Return the elements of the collection as an array.
Return CType(theLanguages.ToArray(GetType(Integer)), Integer())
End Function 'GetLanguagesInNode
/// <summary>
/// Returns the locale identifiers for all the strokes in the node.
/// </summary>
/// <param name="theInkAnalyzer">The ink analyzer containing the node.</param>
/// <param name="theContextNode">The node to check.</param>
/// <returns>An array of unique locale identifiers.</returns>
private int[] GetLanguagesInNode(
Microsoft.Ink.InkAnalyzer theInkAnalyzer,
Microsoft.Ink.ContextNode theContextNode)
{
// Iterate through the strokes within the context node and add the locale
// identifiers to a collection.
System.Collections.ArrayList theLanguages =
new System.Collections.ArrayList();
foreach (Microsoft.Ink.Stroke theStroke in theContextNode.Strokes)
{
int theStrokeLanguage =
theInkAnalyzer.GetStrokeLanguageId(theStroke);
if (!theLanguages.Contains(theStrokeLanguage))
{
theLanguages.Add(theStrokeLanguage);
}
}
// Return the elements of the collection as an array.
return (int[])(theLanguages.ToArray(typeof(int)));
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0