共用方式為


RecognizerContext.PrefixText Property

RecognizerContext.PrefixText Property

Gets or sets the characters that come before the Strokes collection in the RecognizerContext object.

Definition

Visual Basic .NET Public Property PrefixText As String
C# public string PrefixText { get; set; }
Managed C++ public: __property String* get_PrefixText();
public: __property void set_PrefixText(String*);

Property Value

System.String. The characters that come before the Strokes collection in the RecognizerContext object. Must be less than 1k in length.

This property is read/write. This property has no default value.

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site:

Remarks

The prefix helps improve recognition results by supplying the recognizer with more context about the handwriting.

Setting the PrefixText property succeeds only if the Strokes property is null. You must set the PrefixText property before you attach a Strokes collection to the Strokes property of the RecognizerContext or you must set the Strokes property to null and then set the PrefixText property.

Note: If you use the latter method, you may need to reattach the Strokes collection to the Strokes property of the RecognizerContext object.

Setting the PrefixText to null removes any prefix text from the RecognizerContext object.

The prefix text is ignored unless you have set both the Coerce and WordMode RecognitionModes flags in the RecognitionFlags property.

The SuffixText property gets or sets the characters that come after the strokes in the recognizer context and also helps improve the recognition result.

If your application provides a correction interface when converting ink to text, the application may allow the user to select characters within a word and use the pen to generate replacement characters. Your application can use the PrefixText and SuffixText properties to improve recognition of the new ink.

Examples

[C#]

This C# example returns the prefix text of the RecognizerContext object, theRecognizerContext.

string thePrefixText = theRecognizerContext.PrefixText;

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example returns the prefix text of the RecognizerContext object, theRecognizerContext.

Dim thePrefixText As String = theRecognizerContext.PrefixText

See Also