CustomRecognizerNode.InkRecognitionConfidence 属性
返回一个值,该值指示 InkAnalyzer 对于识别结果准确度的置信级别。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.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
属性值
类型:Microsoft.Ink.InkRecognitionConfidence
一个值,指示 InkAnalyzer 对于识别结果准确度的置信级别。
示例
下面的示例使用 TextBox (selectedResultsTextBox)。此前,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
' Only highlight if strong recognition
If customRecognizer.InkRecognitionConfidence = Microsoft.Ink.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.
Dim theStroke As Stroke
For Each theStroke In customRecognizer.Strokes
theStroke.DrawingAttributes = _
New DrawingAttributes(Color.Black)
Next theStroke
Dim selectedNode As ContextNode
For Each selectedNode In selectedNodes
For Each theStroke In selectedNode.Strokes
theStroke.DrawingAttributes = _
New DrawingAttributes(Color.Red)
Next theStroke
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 == Microsoft.Ink.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 =
new DrawingAttributes(Color.Black);
}
foreach (ContextNode selectedNode in selectedNodes)
{
foreach (Stroke stroke in selectedNode.Strokes)
{
stroke.DrawingAttributes =
new DrawingAttributes(Color.Red);
}
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0