PenInputPanel.CurrentPanel 属性

已否决。获取或设置 PenInputPanel 对象中当前用于输入的面板类型。PenInputPanel 已由 Microsoft.Ink.TextInput 替换。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Property CurrentPanel As PanelType
用法
Dim instance As PenInputPanel
Dim value As PanelType

value = instance.CurrentPanel

instance.CurrentPanel = value
public PanelType CurrentPanel { get; set; }
public:
property PanelType CurrentPanel {
    PanelType get ();
    void set (PanelType value);
}
/** @property */
public PanelType get_CurrentPanel()
/** @property */
public  void set_CurrentPanel(PanelType value)
public function get CurrentPanel () : PanelType
public function set CurrentPanel (value : PanelType)

属性值

类型:Microsoft.Ink.PanelType
PanelType 值之一,表示 PenInputPanel 对象中当前用于输入的面板类型。Handwriting 面板类型是默认值。

备注

备注

CurrentPanel 属性不能设置为 DefaultInactive

创建 PenInputPanel 对象时,Handwriting 面板(也称为手写板)是默认输入 UI。

如果在 PenInputPanel 对象第一次变为活动之前,通过设置 CurrentPanel 属性更改面板,则会发生 PanelChanged 事件。

CurrentPanel 属性只能设置为 PanelType 枚举的 HandwritingKeyboard 值。CurrentPanel 属性绝不能设置为 DefaultInactive

如果面板窗口与 PenInputPanel 对象的另一个实例关联,则 CurrentPanel 属性返回 Inactive 枚举值。如果面板不活动,并且面板类型无效,则设置 CurrentPanel 属性将引发异常。

ms571976.alert_security(zh-cn,VS.90).gif安全说明:

如果在部分信任环境下使用,则除了 PenInputPanel 所需的权限以外,该属性还需要 SecurityPermissionFlag.AllFlags 权限。有关更多信息,请参见Security and Trust

示例

此 C# 示例创建 PenInputPanel 对象 thePenInputPanel,并将它附加到 InkEdit 控件 theInkEdit。它将 VisibleChanged 事件处理程序 VisibleChanged_Event 附加到 thePenInputPanel。只要通过将 CurrentPanel 属性设置为 Keyboard 使键盘面板变为可见,事件处理程序就会强制笔输入面板显示键盘面板。

[C#]

//...

// Declare the PenInputPanel object
PenInputPanel thePenInputPanel;

public Form1()
{
    // Required for Windows Form Designer support
    InitializeComponent();

    // Create and attach the new PenInputPanel to an InkEdit control.
    thePenInputPanel = new PenInputPanel(theInkEdit);

    // Add a VisibleChanged event handler
    thePenInputPanel.VisibleChanged +=
        new PenInputPanelVisibleChangedEventHandler(VisibleChanged_Event);
}

//...

public void VisibleChanged_Event(object sender,
                                 PenInputPanelVisibleChangedEventArgs e)
{
    // Make sure the object that generated
    // the event is a PenInputPanel object
    if (sender is PenInputPanel)
    {
        PenInputPanel theSenderPanel = (PenInputPanel)sender;

        // If the panel has become visible...
        if (e.NewVisibility)
        {
            // Always default to keyboard input
            if (theSenderPanel.CurrentPanel == PanelType.Handwriting)
            {
                theSenderPanel.CurrentPanel = PanelType.Keyboard;
            }
        }
    }
}

此 Microsoft(R) Visual Basic(R) .NET 示例创建 PenInputPanel 对象 thePenInputPanel,并将它附加到 InkEdit 控件 theInkEdit。它将 VisibleChanged 事件处理程序 VisibleChanged_Event 附加到 thePenInputPanel。只要通过将 CurrentPanel 属性设置为 Keyboard 使键盘面板变为可见,事件处理程序就会强制笔输入面板显示键盘面板。

[Visual Basic]

'...

' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel

Public Sub New()
    MyBase.New()

    ' Required for Windows Form Designer support
    InitializeComponent()

    ' Create and attach the new PenInputPanel to an InkEdit control.
    thePenInputPanel = New PenInputPanel(theInkEdit)

    ' Add a VisibleChanged event handler
    AddHandler thePenInputPanel.VisibleChanged, _
               AddressOf VisibleChanged_Event
End Sub 'New


'...
Public Sub VisibleChanged_Event(sender As Object, e As _
                                PenInputPanelVisibleChangedEventArgs)
    ' Make sure the object that generated
    ' the event is a PenInputPanel object
    If TypeOf sender Is PenInputPanel Then
       Dim theSenderPanel As PenInputPanel = CType(sender, PenInputPanel)

       ' If the panel has become visible...
       If e.NewVisibility Then
          ' Always default to keyboard input
          If theSenderPanel.CurrentPanel = PanelType.Handwriting Then
             theSenderPanel.CurrentPanel = PanelType.Keyboard
          End If
       End If
    End If
End Sub 'VisibleChanged_Event

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

PenInputPanel 类

PenInputPanel 成员

Microsoft.Ink 命名空间

PenInputPanel.DefaultPanel

PanelType