Share via


RecognizerContext.Guide Property

Gets or sets the RecognizerGuide to use for ink input.

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

Syntax

'Declaration
Public Property Guide As RecognizerGuide
'Usage
Dim instance As RecognizerContext 
Dim value As RecognizerGuide 

value = instance.Guide

instance.Guide = value
public RecognizerGuide Guide { get; set; }
public:
property RecognizerGuide Guide {
    RecognizerGuide get ();
    void set (RecognizerGuide value);
}
public function get Guide () : RecognizerGuide 
public function set Guide (value : RecognizerGuide)

Property Value

Type: Microsoft.Ink.RecognizerGuide
The RecognizerGuide to use for ink input.

Remarks

Setting the Guide property succeeds only if the Strokes property is nulla null reference (Nothing in Visual Basic). You must set the Guide property before you attach a Strokes collection to the Strokes property of the RecognizerContext, or you must set the Strokes property to nulla null reference (Nothing in Visual Basic) and then set the Guide property.

Note

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

The RecognizerCapabilities enumeration contains the FreeInput, LinedInput, and BoxedInput flags. These flags specify the capabilities of a recognizer, but because they are read-only, there is no way to set any of these directly on a Recognizer or RecognizerContext object. The only way to set a recognizer to a specific mode is to set the recognition guide by using the Guide property.

If you do not set the Guide property, the default value is FreeInput mode, assuming that the recognizer is capable of this mode.

The following table lists potential input modes and which values to set the Columns and Rows properties for each mode.

For this type of input

Set the Rows property to

And set the Columns property to

Free input

0

0

Vertical Lined input with 1 line

0

1

Vertical Lined input with n lines

0

n

Horizontal Lined input with 1 line

1

0

Horizontal Lined input with n lines

n

0

Boxed input with 1 box

1

1

Boxed input with n boxes

n

1

Boxed input in a grid of boxes x rows by z columns

x

z

If you set the mode to one that is not available for a Recognizer object, an ArgumentException exception is thrown.

To query which capabilities—or modes—are available from a specific recognizer, use the Capabilities property of the Recognizer object. In Windows Vista, recognizers of Latin script support free input, boxed input, and horizontal lined input; recognizers of East Asian characters support free input and boxed input; and the gesture recognizer supports only free input.

Examples

In this example, a RecognizerContext object is instantiated, and the Guide property assigned.

' 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;
}

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

RecognizerContext Class

RecognizerContext Members

Microsoft.Ink Namespace

RecognizerContext

RecognizerGuide

Recognizer

RecognizerCapabilities

Recognizer.Capabilities

RecognizerContext.Strokes

RecognizerGuide.Columns

RecognizerGuide.Rows