CustomRecognizerNode.InkRecognitionConfidence 属性

返回由 InkAnalyzer 输出的、关于识别结果准确度的置信级别。

命名空间:  System.Windows.Ink
程序集:  IAWinFX(在 IAWinFX.dll 中)

语法

声明
Public ReadOnly Property InkRecognitionConfidence As InkRecognitionConfidence
用法
Dim instance As CustomRecognizerNode
Dim value As InkRecognitionConfidence

value = instance.InkRecognitionConfidence
public InkRecognitionConfidence InkRecognitionConfidence { get; }
public:
property InkRecognitionConfidence InkRecognitionConfidence {
    InkRecognitionConfidence get ();
}
/** @property */
public InkRecognitionConfidence get_InkRecognitionConfidence()
public function get InkRecognitionConfidence () : InkRecognitionConfidence

属性值

类型:System.Windows.Ink.InkRecognitionConfidence
InkAnalyzer 输出的、关于识别结果准确度的置信级别。

示例

下面的示例使用名为 selectedResultsTextBox 的 TextBox。在此之前,Text 属性已设置为 CustomRecognizerNode 对象(名为 customRecognizer)的 GetRecognizedString 所返回的值。用户已选中了 TextBox 中的一些文本。如果 InkRecognitionConfidence 级别为 Strong(),则与此选定内容对应的 Strokes 突出显示为红色。

' Find out what's been selected in the text box
Dim start As Integer = selectedResultsTextBox.SelectionStart
Dim length As Integer = selectedResultsTextBox.SelectionLength

' Return if no text is selected.
If length = 0 Then
    Return
End If

' Only highlight if strong recognition
If customRecognizer.InkRecognitionConfidence = _
   InkRecognitionConfidence.Strong Then

    Dim selectedNodes As ContextNodeCollection = _
        customRecognizer.GetNodesFromTextRange(start, length)

    ' Use the new start and length value to update the
    ' selection in the TextBox
    selectedResultsTextBox.SelectionStart = start
    selectedResultsTextBox.SelectionLength = length

    ' Color the strokes red if part of the selected words.
    ' Otherwise, color them black.
    For Each Stroke As Stroke In customRecognizer.Strokes
        Stroke.DrawingAttributes.Color = Colors.Black
    Next Stroke

    For Each selectedNode As ContextNode In selectedNodes
        For Each Stroke As Stroke In selectedNode.Strokes
            Stroke.DrawingAttributes.Color = Colors.Red
        Next Stroke
    Next selectedNode
End If
// Find out what's been selected in the text box
int start = selectedResultsTextBox.SelectionStart;
int length = selectedResultsTextBox.SelectionLength;

// Return if no text is selected.
if (length == 0)
    return;

// Only highlight if strong recognition
if (customRecognizer.InkRecognitionConfidence == InkRecognitionConfidence.Strong)
{
    ContextNodeCollection selectedNodes =
        customRecognizer.GetNodesFromTextRange(ref start, ref length);

    // Use the new start and length value to update the
    // selection in the TextBox
    selectedResultsTextBox.SelectionStart = start;
    selectedResultsTextBox.SelectionLength = length;

    // Color the strokes red if part of the selected words.
    // Otherwise, color them black.
    foreach (Stroke stroke in customRecognizer.Strokes)
    {
        stroke.DrawingAttributes.Color = Colors.Black;
    }
    foreach (ContextNode selectedNode in selectedNodes)
    {
        foreach (Stroke stroke in selectedNode.Strokes)
        {
            stroke.DrawingAttributes.Color = Colors.Red;
        }
    }
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

CustomRecognizerNode 类

CustomRecognizerNode 成员

System.Windows.Ink 命名空间