Partager via


PenInputPanelChangedEventHandler Delegate

PenInputPanelChangedEventHandler Delegate

Represents the method that handles the PanelChanged event of a PenInputPanel object.

Definition

Visual Basic .NET Public Delegate Sub PenInputPanelChangedEventHandler( _
ByVal sender As Object, _
ByVal e As PenInputPanelChangedEventArgs _
)
C# public delegate void PenInputPanelChangedEventHandler(
object sender,
PenInputPanelChangedEventArgs e
);
Managed C++ public: __gc __delegate void PenInputPanelChangedEventHandler(
Object *sender,
PenInputPanelChangedEventArgs *e
);

Parameters

sender System.Object. [in] Specifies the source PenInputPanel object of this event.
e Microsoft.Ink.PenInputPanelChangedEventArgs. [in] Specifies the PenInputPanelChangedEventArgs object that contains the event data.

Delegate Information

Namespace Microsoft.Ink
Assembly Microsoft.Ink (microsoft.ink.dll)
Strong Name Microsoft.Ink, Version=1.7.4009.0, Culture=neutral, PublicKeyToken=a2870d9cc4d021c8

Remarks

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.

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