PenInputPanel.Refresh Method
PenInputPanel.Refresh Method |
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.
Definition
Visual Basic .NET Public Sub Refresh() C# public void Refresh(); Managed C++ public: void Refresh();
Exceptions
COMException :
ObjectDisposedException : The PenInputPanel object is disposed.
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 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.
Examples
[C#]
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.
//... // 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(); } } }
[Visual Basic .NET]
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.
'... ' 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
See Also