Partager via


PenInputPanelVisibleChangedEventHandler Delegate

PenInputPanelVisibleChangedEventHandler Delegate

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

Definition

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

Parameters

sender System.Object. [in] Specifies the source PenInputPanel object of this event.
e Microsoft.Ink.PenInputPanelVisibleChangedEventArgs. [in] Specifies the PenInputPanelVisibleChangedEventArgs 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

The VisibleChanged event occurs when the PenInputPanel object has shown or hidden itself.

Examples

[C#]

This C# example creates a PenInputPanel object, thePenInputPanel and attaches it to an InkEdit control, inkEdit1. It adds a VisibleChanged event handler, VisibleChanged_Event, to the form for the PenInputPanel. In the event handler, if the pen input panel is visible, its position is changed to screen coordinates 100, 100 by calling the MoveTo 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(inkEdit1);

    // 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)
        {
            // Move the pen input panel to
            // screen position 100, 100
            theSenderPanel.MoveTo(100, 100);
        }
    }
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a PenInputPanel object, thePenInputPanel and attaches it to an InkEdit control, InkEdit1. It adds a VisibleChanged event handler, VisibleChanged_Event, to the form for the PenInputPanel. In the event handler, if the pen input panel is visible, its position is changed to screen coordinates 100, 100 by calling the MoveTo 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(InkEdit1)

    ' 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
          ' Move the pen input panel to
          ' screen position 100, 100
          theSenderPanel.MoveTo(100, 100)
       End If
    End If
End Sub 'VisibleChanged_Event

See Also