Share via


PenInputPanel.Refresh Method

Deprecated. Updates and restores the PenInputPanel properties based on Tablet PC Input Panel, automatically positions the pen input panel, and sets the user interface to the default panel. PenInputPanel has been replaced by Microsoft.Ink.TextInput.

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

Syntax

'Declaration
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
<UIPermissionAttribute(SecurityAction.Demand, Window := UIPermissionWindow.SafeTopLevelWindows)> _
<SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted := True)> _
Public Sub Refresh
'Usage
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()
public function Refresh()

Remarks

The Refresh method restores the default panel. For example, if the DefaultPanel property is set to Keyboard and the CurrentPanel property is set to Handwriting, the Refresh method sets the pen input panel to Keyboard. If the DefaultPanel property is set to Default, the Refresh method does not change the pen input panel.

The Refresh method automatically positions the pen input panel relative to the control to which it is attached.

The Refresh method updates the pen input panel by using the Tablet PC Input Panel settings. For instance, you can make changes to the PenInputPanel object, then call Refresh to restore the settings to those copied from Input Panel.

The PenInputPanel object is updated automatically whenever the settings change on Input Panel.

Calling the Refresh method while the pen input panel does not have focus generates an error.

Note

Normally, you do not need to call Refresh, because the functionality is expressed during activation of the pen input panel. However, if the AutoShow property is set to false, you can disable activation of the pen input panel. If so, use the Refresh method to refresh the PenInputPanel object.

Note

Starting with Microsoft® Windows® XP Tablet PC Edition 2005, the Refresh method is deprecated and does nothing.

Security noteSecurity Note:

If using under partial trust, this method requires SecurityPermissionFlag.AllFlags permission, in addition to the permissions required by PenInputPanel. See Security and Trust for more information.

Examples

This C# example attaches a PenInputPanel object, thePenInputPanel, to an InkEdit control, theInkEdit. It adds a VisibleChanged event handler, VisibleChanged_Event, to the form for the PenInputPanel. In the event handler, if the PenInputPanel object is visible, its settings are restored to those of Input Panel by calling the Refresh method.

[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();
        }
    }
}

This Microsoft Visual Basic .NET example attaches a PenInputPanel object, thePenInputPanel, to an InkEdit control, theInkEdit. It adds a VisibleChanged event handler, VisibleChanged_Event, to the form for the PenInputPanel. In the event handler, if the PenInputPanel object is visible, its settings are restored to those of Input Panel by calling the Refresh method.

[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

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

PenInputPanel Class

PenInputPanel Members

Microsoft.Ink Namespace

Other Resources

Programming the Text Input Panel