Share via


RecognizerGuide Structure

Represents the area that the Recognizer object uses and in which ink can be drawn. The area is known as the recognizer guide.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Structure RecognizerGuide
'Usage
Dim instance As RecognizerGuide
public struct RecognizerGuide
public value class RecognizerGuide
JScript supports the use of structures, but not the declaration of new ones.

Remarks

The recognizer guide can consist of rows and columns, and gives the recognizer a better context in which to perform recognition. For example, you can draw horizontal lines on a user's screen, almost like a ruled piece of paper, that show where inking should occur (this type of guide would consist only of rows, and no columns). If a user writes on the lines, instead of some arbitrary space, recognition accuracy improves. For illustrations of recognizer guides, see Ink Recognition.

Letters such as "t" and "I" are more easily recognized when a guide is used to give context to the ink.

The guide specifies the boundaries of the ink in ink space coordinates. The DrawnBox property can define a box which is the same size as or smaller than the box defined by the WritingBox property. This allows for disparate writing styles. If the user writes outside the DrawnBox but within the WritingBox, the Recognizer object uses all of the ink to aid in recognition.

If the application has drawn guidelines on the screen on which the user is expected to write, the application should set the values of the properties of the recognizer guide to inform the recognizer. These properties are for the recognizer's use only. Setting them does not, by itself, draw visual clues on the display. The application or the control draws the visual clues.

In addition to drawing lines, or rules, on the screen that show users where to write, it is also possible to draw cells on the screen in which characters or words are written. This is called boxed input and is useful with some East Asian languages. To determine if the recognizer is capable of boxed input, call the Capabilities property of the Recognizer object.

By default, there is no guide. A default guide has all property values set to 0. You must use the properties of this object to set the guide.

Examples

In this example, a RecognizerContext object is instantiated, and the Guide property assigned by creating a new RecognizerGuide object.

' create a new RecognizerContext object
mRecognizerContext = New RecognizerContext()
' if the Recognizer supports LinedInput, set the Guide 
If (mRecognizerContext.Recognizer.Capabilities And RecognizerCapabilities.LinedInput) <> 0 Then 
    ' get the lower right corner in pixel units 
    Dim lowerRight As Point = New Point(mInkOverlay.AttachedControl.Width, mInkOverlay.AttachedControl.Height)
    ' convert to ink space units
    mInkOverlay.Renderer.PixelToInkSpace(Me.CreateGraphics(), lowerRight)
    ' create Rectangles 
    Dim writingBox As Rectangle = New Rectangle(0, 0, lowerRight.X, lowerRight.Y)
    Dim drawnBox As Rectangle = New Rectangle(0, 0, lowerRight.X, lowerRight.Y)
    ' shrink drawn box relative to writing box
    drawnBox.Inflate(-100, -100)
    ' create Guide with 8 rows, zero columns, and no midline 
    Dim guide As RecognizerGuide = New RecognizerGuide(8, 0, 0, writingBox, drawnBox)
    mRecognizerContext.Guide = guide
End If
// create a new RecognizerContext object
mRecognizerContext = new RecognizerContext();
// if the Recognizer supports LinedInput, set the Guide 
if ((mRecognizerContext.Recognizer.Capabilities & RecognizerCapabilities.LinedInput) != 0)
{
    // get the lower right corner in pixel units
    Point lowerRight = new Point(mInkOverlay.AttachedControl.Width, mInkOverlay.AttachedControl.Height);
    // convert to ink space units
    mInkOverlay.Renderer.PixelToInkSpace(this.CreateGraphics(), ref lowerRight);
    // create Rectangles
    Rectangle writingBox = new Rectangle(0, 0, lowerRight.X, lowerRight.Y);
    Rectangle drawnBox = new Rectangle(0, 0, lowerRight.X, lowerRight.Y);
    // shrink drawn box relative to writing box
    drawnBox.Inflate(-100, -100);
    // create Guide with 8 rows, zero columns, and no midline
    RecognizerGuide guide = new RecognizerGuide(8, 0, 0, writingBox, drawnBox);
    mRecognizerContext.Guide = guide;
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

RecognizerGuide Members

Microsoft.Ink Namespace

Recognizer

RecognizerContext