Compartir a través de


PenInputPanel.PanelChanged Event

PenInputPanel.PanelChanged Event

Occurs when the PenInputPanel object changes between layouts.

Definition

Visual Basic .NET Public Event PanelChanged As PenInputPanelChangedEventHandler
C# public event PenInputPanelChangedEventHandler PanelChanged;
Managed C++ public: __event PenInputPanelChangedEventHandler PanelChanged;

Remarks

The event handler receives an argument of type PenInputPanelChangedEventArgs containing data about this event.

When creating a PenInputPanel object, the Handwriting panel is the default. If the panel is changed by setting the CurrentPanel property before the pen input panel becomes active for the first time, a PanelChanged event occurs.

The PanelChanged event is not raised when the user changes between Lined and Boxed writing pads.

Examples

[C#]

This C# example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, inkEdit1. It then adds a PanelChanged event handler to thePenInputPanel. The PanelChanged handler sets the text of the attached InkEdit control to a sentence containing the new panel type.

//...

// 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(inkEdit1);

    // Add a PanelChanged event handler
    thePenInputPanel.PanelChanged +=
        new PenInputPanelChangedEventHandler(PanelChanged_Event);
}

//...

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

        theSenderPanel.AttachedEditControl.Text = "The panel has changed to ";
        theSenderPanel.AttachedEditControl.Text += e.NewPanelType.ToString();
    }
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, InkEdit1. It then adds a PanelChanged event handler to thePenInputPanel. The PanelChanged handler sets the text of the attached InkEdit control to a sentence containing the new panel type.

'...

' 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(InkEdit1)

   ' Add a PanelChanged event handler
   AddHandler thePenInputPanel.PanelChanged, AddressOf PanelChanged_Event
End Sub 'New

'...

Public Sub PanelChanged_Event(ByVal sender As Object, ByVal e As _
                              PenInputPanelChangedEventArgs)
    ' 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)

        theSenderPanel.AttachedEditControl.Text = "The panel has changed to "
        theSenderPanel.AttachedEditControl.Text += e.NewPanelType.ToString
    End If
End Sub 'PanelChanged_Event

See Also