Condividi tramite


Evento PenInputPanel.PanelMoving

Aggiornamento: novembre 2007

Obsoleto. Si verifica quando l'oggetto PenInputPanel si sta spostando. L'oggetto PenInputPanel è stato sostituito dall'oggetto Microsoft.Ink.TextInput.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Event PanelMoving As PenInputPanelMovingEventHandler
'Utilizzo
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)
JScript non supporta gli eventi.

Note

Il gestore eventi riceve un argomento di tipo PenInputPanelMovingEventArgs contenente i dati relativi a questo evento.

Utilizzare l'evento PanelMoving per modificare la posizione dell'oggetto PenInputPanel cambiando i membri Left e Top dell'oggetto PenInputPanelMovingEventArgs.

Avviso

I metodi MoveTo e Refresh fanno in modo che l'oggetto PenInputPanel chiami il proprio codice di posizionamento automatico che attiva un evento PanelMoving. Di conseguenza, la chiamata a questi metodi in un gestore PanelMoving può comportare un ciclo infinito.

ms567748.alert_security(it-it,VS.90).gifNota sulla sicurezza:

Se utilizzato in attendibilità parziale, questo evento richiede l'autorizzazione SecurityPermissionFlag.AllFlags, oltre alle autorizzazioni richieste dall'oggetto PenInputPanel. Per ulteriori informazioni, vedere Security and Trust.

Esempi

In questo esempio di Microsoft® Visual C#® viene creato un oggetto PenInputPanel, thePenInputPanel, che viene associato a un controllo InkEdit, theInkEdit. Vengono quindi aggiunti un gestore eventi PanelMoving e un gestore eventi VisibleChanged all'oggetto thePenInputPanel. Nel gestore VisibleChanged, la posizione del pannello input penna viene modificata, con la conseguente generazione dell'evento PanelMoving. Successivamente, il gestore di PanelMoving imposta il testo del controllo InkEdit associato su una frase che contiene le nuove coordinate dello schermo del pannello input penna.

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

In questo esempio di Microsoft Visual Basic® .NET viene creato un oggetto PenInputPanel, thePenInputPanel, che viene associato a un controllo InkEdit, theInkEdit. Vengono quindi aggiunti un gestore eventi PanelMoving e un gestore eventi VisibleChanged all'oggetto thePenInputPanel. Nel gestore VisibleChanged, la posizione del pannello input penna viene modificata, con la conseguente generazione dell'evento PanelMoving. Successivamente, il gestore di PanelMoving imposta il testo del controllo InkEdit associato su una frase che contiene le nuove coordinate dello schermo del pannello input penna.

[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

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

PenInputPanel Classe

Membri PenInputPanel

Spazio dei nomi Microsoft.Ink

PenInputPanel.OnPanelMoving