共用方式為


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 命名空間