Поделиться через


RecognizerContext.Guide - свойство

Обновлен: Ноябрь 2007

Gets or sets the RecognizerGuide to use for ink input.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Property Guide As RecognizerGuide
'Применение
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);
}
/** @property */
public RecognizerGuide get_Guide()
/** @property */
public  void set_Guide(RecognizerGuide value)
public function get Guide () : RecognizerGuide
public function set Guide (value : RecognizerGuide)

Значение свойства

Тип: Microsoft.Ink.RecognizerGuide
The RecognizerGuide to use for ink input.

Заметки

Setting the Guide property succeeds only if the Strokes property is nullссылка null (Nothing в 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 nullссылка null (Nothing в Visual Basic) and then set the Guide property.

ms572018.alert_note(ru-ru,VS.90).gifПримечание.

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.

Примеры

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

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

RecognizerContext Класс

RecognizerContext - члены

Microsoft.Ink - пространство имен

RecognizerContext

RecognizerGuide

Recognizer

RecognizerCapabilities

Recognizer.Capabilities

RecognizerContext.Strokes

RecognizerGuide.Columns

RecognizerGuide.Rows