次の方法で共有


PenInputPanel.EnableTsf Method

PenInputPanel.EnableTsf Method

Indicates whether or not the PenInputPanel object attempts to send text to the attached control through the Text Services Framework (TSF) and enables the use of the correction user interface.

Definition

Visual Basic .NET Public Sub EnableTsf( _
ByVal enable As Boolean _
)
C# public void EnableTsf(
bool enable
);
Managed C++ public: void EnableTsf(
bool *enable
);

Parameters

> > >
enable System.Boolean. A Boolean variable that indicates whether or not the PenInputPanel object attempts to send text to the attached control through the Text Services Framework (TSF) and enables the use of the correction user interface.

true Default. The PenInputPanel object attempts to send text to the attached control through the Text Services Framework (TSF), and the correction user interface is enabled.
false The PenInputPanel object attempts to disable Text Services Framework (TSF) on the attached control. The correction user interface is unavailable.

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site: The PenInputPanel object is disposed.

Remarks

Calling this method with the enable parameter set to true causes the PenInputPanel object to attempt to start the Text Services Framework (TSF) on the attached control.

Note:

Support has been added to TSF and to provide a consistent user interface for all applications across the desktop. This new support enables legacy applications or controls that are not aware of TSF to take advantage of some advanced text services. For example, speech dictation and handwriting can now be used to enter text into a document in any application.

This new feature is available and enabled by default on Microsoft® Windows® XP Tablet PC Edition. To enable or disable the feature:

  1. In Control Panel, click Regional and Language Options.
  2. On the Languages tab, click Details.
  3. On the Advanced tab of the Text Services and Input Languages dialog box, select or clear Extend support of advanced text services to all programs.

If successful, text is sent to the attached control through TSF. Furthermore, if the control supports TSF (and is not receiving text from TSF only because Advanced Text Services is enabled, as in the previous procedure), then the correction user interface appears in the control with access to handwriting alternates. Calling this method with the enable parameter set to false causes the PenInputPanel object to attempt to disable TSF on the attached control.

Use the EnableTsf method to enable the PenInputPanel to use the TSF insertion context rather than SendInput Function Leave Site to send the handwriting recognition results into the control. By enabling the PenInputPanel to use the TSF insertion context, text can be inserted even if the field no longer has focus.

When you call this method with the enable parameter set to true, the PenInputPanel object sends an EM_SETEDITSTYLE message to the attached control. If the control does not support this message, results may be unpredictable.

The InkEdit control does support TSF.

Examples

[C#]

This C# example attaches a PenInputPanel object, thePenInputPanel, to an InkEdit control, theInkEdit. The EnableTsf method is called on the PenInputPanel to start the TSF.

// Declare, create, and attach a new
// PenInputPanel to an InkEdit control.
PenInputPanel thePenInputPanel = new PenInputPanel(theInkEdit);

// Start the Text Services Framework
thePenInputPanel.EnableTsf(true);

[Visual Basic .NET]

This Microsoft Visual Basic® .NET example attaches a PenInputPanel object, thePenInputPanel, to an InkEdit control, theInkEdit. The EnableTsf method is called on the PenInputPanel to start the TSF.

'Declare, create, and attach a new
'PenInputPanel to an InkEdit control.
Dim thePenInputPanel As New PenInputPanel(theInkEdit)

'Start the Text Services Framework
thePenInputPanel.EnableTsf(True)