InkCanvas.SelectionChanging Evento

Definizione

Si verifica quando viene selezionato un nuovo insieme di tratti input penna e/o elementi.

public:
 event System::Windows::Controls::InkCanvasSelectionChangingEventHandler ^ SelectionChanging;
public event System.Windows.Controls.InkCanvasSelectionChangingEventHandler SelectionChanging;
member this.SelectionChanging : System.Windows.Controls.InkCanvasSelectionChangingEventHandler 
Public Custom Event SelectionChanging As InkCanvasSelectionChangingEventHandler 
Public Event SelectionChanging As InkCanvasSelectionChangingEventHandler 

Tipo evento

Esempio

L'esempio seguente rende i tratti selezionati blu reale.

void inkCanvas1_SelectionChanging(object sender, InkCanvasSelectionChangingEventArgs e)
{
    StrokeCollection selectedStrokes = e.GetSelectedStrokes();
    
    foreach (Stroke aStroke in inkCanvas1.Strokes)
    {
        if (selectedStrokes.Contains(aStroke))
        {
            aStroke.DrawingAttributes.Color = Colors.RoyalBlue;
        }
        else
        {
            aStroke.DrawingAttributes.Color = inkCanvas1.DefaultDrawingAttributes.Color;
        }
    }
}
Private Sub inkCanvas1_SelectionChanging(ByVal sender As Object, _
                                 ByVal e As InkCanvasSelectionChangingEventArgs)

    Dim selectedStrokes As StrokeCollection = e.GetSelectedStrokes()

    Dim aStroke As Stroke
    For Each aStroke In inkCanvas1.Strokes
        If selectedStrokes.Contains(aStroke) Then
            aStroke.DrawingAttributes.Color = Colors.RoyalBlue
        Else
            aStroke.DrawingAttributes.Color = inkCanvas1.DefaultDrawingAttributes.Color
        End If
    Next aStroke

End Sub

Commenti

L'evento SelectionChanging viene generato quando i tratti e/o gli elementi vengono selezionati dall'utente, ma prima che venga applicata la modifica.

L'evento SelectionChanging viene elaborato quando riceve InkCanvasSelectionChangingEventHandler un InkCanvasSelectionChangingEventArgs oggetto. InkCanvasSelectionChangingEventArgs fornisce metodi per l'accesso agli FrameworkElement oggetti e StrokeCollection dopo che sono selezionati dall'utente.

Dopo l'applicazione della modifica, viene generato l'evento SelectionChanged .

Nota

L'evento SelectionChanging non si verifica quando i tratti selezionati vengono eliminati o quando la ActiveEditingMode proprietà cambia.

Si applica a

Vedi anche