Share via


PenInputPanel.PanelMoving Event

Deprecated. Occurs when the PenInputPanel object is moving. PenInputPanel has been replaced by Microsoft.Ink.TextInput.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public Event PanelMoving As PenInputPanelMovingEventHandler
'Usage
Dim instance As PenInputPanel
Dim handler As PenInputPanelMovingEventHandler

AddHandler instance.PanelMoving, handler
public event PenInputPanelMovingEventHandler PanelMoving
public:
event PenInputPanelMovingEventHandler^ PanelMoving {
    void add (PenInputPanelMovingEventHandler^ value);
    void remove (PenInputPanelMovingEventHandler^ value);
}
/** @event */
public void add_PanelMoving (PenInputPanelMovingEventHandler value)

/** @event */
public void remove_PanelMoving (PenInputPanelMovingEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

Remarks

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

Use the PanelMoving event to change the position of the PenInputPanel object by changing the Left and Top members of the PenInputPanelMovingEventArgs object.

Warning

The MoveTo and Refresh methods cause the PenInputPanel object to call its auto-positioning code, which triggers a PanelMoving event. Consequently, calling these methods inside a PanelMoving handler can result in an endless loop.

Security noteSecurity Note:

If using under partial trust, this event requires SecurityPermissionFlag.AllFlags permission, in addition to the permissions required by PenInputPanel. See Security and Trust for more information.

Example

This Microsoft® Visual C#® example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, theInkEdit. It then adds a PanelMoving event handler and a VisibleChanged event handler to thePenInputPanel. In the VisibleChanged handler, the position of the pen input panel is changed, causing the PanelMoving event to fire. Subsequently, the PanelMoving handler sets the text of the attached InkEdit control to a sentence containing the new screen coordinates of the pen input panel.

[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 PanelMoving event handler
    thePenInputPanel.PanelMoving +=
        new PenInputPanelMovingEventHandler(PanelMoving_Event);

    // Add a VisibleChanged event handler
    thePenInputPanel.VisibleChanged +=
        new PenInputPanelVisibleChangedEventHandler(VisibleChanged_Event);
}

//...

public void PanelMoving_Event(object sender,
PenInputPanelMovingEventArgs 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 moved to ";
        theSenderPanel.AttachedEditControl.Text += e.Left.ToString();
        theSenderPanel.AttachedEditControl.Text += ", ";
        theSenderPanel.AttachedEditControl.Text += e.Top.ToString();
    }
}

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);
        }
    }
}

This Microsoft Visual Basic® .NET example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, theInkEdit. It then adds a PanelMoving event handler and a VisibleChanged event handler to thePenInputPanel. In the VisibleChanged handler, the position of the pen input panel is changed, causing the PanelMoving event to fire. Subsequently, the PanelMoving handler sets the text of the attached InkEdit control to a sentence containing the new screen coordinates of the pen input panel.

[Visual Basic]

'...

' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel

Public Sub New()
    MyBase.New()

    ' Required for Windows Form Designer support
    InitializeComponent();

    ' Create and attach the new PenInputPanel to an InkEdit control.
    thePenInputPanel = New PenInputPanel(theInkEdit)

    ' Add a PanelMoving event handler
    AddHandler thePenInputPanel.PanelMoving, _
               AddressOf PanelMoving_Event

    ' Add a VisibleChanged event handler
    AddHandler thePenInputPanel.VisibleChanged, _
               AddressOf VisibleChanged_Event
End Sub 'New

'...

Public Sub PanelMoving_Event(sender As Object, e As _
                             PenInputPanelMovingEventArgs)
    ' 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 moved to "
       theSenderPanel.AttachedEditControl.Text += e.Left.ToString
       theSenderPanel.AttachedEditControl.Text += ", "
       theSenderPanel.AttachedEditControl.Text += e.Top.ToString
    End If
End Sub 'PanelMoving_Event

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

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
PenInputPanel.OnPanelMoving