PenInputPanel.Refresh 方法

已否决。根据 Tablet PC 输入面板 更新和还原 PenInputPanel 属性,自动定位笔输入面板,并将用户界面设置为默认面板。PenInputPanel 已由 Microsoft.Ink.TextInput 替换。

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

语法

声明
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
<UIPermissionAttribute(SecurityAction.Demand, Window := UIPermissionWindow.SafeTopLevelWindows)> _
<SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted := True)> _
Public Sub Refresh
用法
Dim instance As PenInputPanel

instance.Refresh()
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
[UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
public void Refresh()
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = L"FullTrust")]
[UIPermissionAttribute(SecurityAction::Demand, Window = UIPermissionWindow::SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction::Demand, Unrestricted = true)]
public:
void Refresh()
/** @attribute PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust") */
/** @attribute UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows) */
/** @attribute SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true) */
public void Refresh()
public function Refresh()

备注

Refresh 方法还原默认面板。例如,如果 DefaultPanel 属性设置为 KeyboardCurrentPanel 属性设置为 Handwriting,则 Refresh 方法将笔输入面板设置为 Keyboard。如果 DefaultPanel 属性设置为 Default,则 Refresh 方法不更改笔输入面板。

Refresh 方法相对于它附加到的控件自动定位笔输入面板。

通过使用 Tablet PC 输入面板 设置,Refresh 方法更新笔输入面板。例如,您可以对 PenInputPanel 对象进行更改,然后调用 Refresh 将设置还原为从输入面板复制的设置。

只要输入面板的设置发生更改,就会自动更新 PenInputPanel 对象。

在笔输入面板没有焦点时调用 Refresh 方法将生成错误。

备注

通常,不需要调用 Refresh,因为该功能是在笔输入面板的激活期间表示的。但是,如果 AutoShow 属性设置为 false,则可以禁用笔输入面板的激活。如果这样,请使用 Refresh 方法刷新 PenInputPanel 对象。

备注

从 Microsoft(R) Windows(R) XP Tablet PC Edition 2005 开始,Refresh 方法已被否决,它不执行任何操作。

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

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

示例

此 C# 示例将 PenInputPanel 对象 thePenInputPanel 附加到 InkEdit 控件 theInkEdit。它将一个 VisibleChanged 事件处理程序 VisibleChanged_Event 添加到 PenInputPanel 的窗体。在该事件处理程序中,如果 PenInputPanel 对象可见,则通过调用 Refresh 方法将其设置还原为输入面板的设置。

[C#]

//...

// Delcare 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 PenInputPanelVisibleChanged 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)
        {
            // Restore the pen input panel settings
            // from the global Input Panel
            theSenderPanel.Refresh();
        }
    }
}

此 Microsoft Visual Basic .NET 示例将 PenInputPanel 对象 thePenInputPanel 附加到 InkEdit 控件 theInkEdit。它将一个 VisibleChanged 事件处理程序 VisibleChanged_Event 添加到 PenInputPanel 的窗体。在该事件处理程序中,如果 PenInputPanel 对象可见,则通过调用 Refresh 方法将其设置还原为输入面板的设置。

[Visual Basic]

'...

' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel

Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

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

    ' Add a PenInputPanelVisibleChanged 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
          ' Restore the pen input panel settings
          ' from the global Input Panel
            theSenderPanel.Refresh()
       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 命名空间

其他资源

Programming the Text Input Panel