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
Public Sub Refresh
'Usage
Dim instance As PenInputPanel

instance.Refresh
public void Refresh ()
public:
void Refresh ()
public void Refresh ()
public function Refresh ()
Not applicable.

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.

Example

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

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