Partager via


InkCanvas.SelectionChanging Événement

Définition

Se produit lorsqu’un nouvel ensemble de traits d’encre et/ou d’éléments est sélectionné.

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 

Type d'événement

Exemples

L’exemple suivant montre comment rendre les traits sélectionnés bleu royal.

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

Remarques

L’événement SelectionChanging est déclenché lorsque des traits et/ou des éléments sont sélectionnés par l’utilisateur, mais avant l’application de la modification.

L’événement SelectionChanging est traité lorsque l’objet InkCanvasSelectionChangingEventHandler reçoit.InkCanvasSelectionChangingEventArgs InkCanvasSelectionChangingEventArgs fournit des méthodes d’accès FrameworkElement et StrokeCollection d’objets après leur sélection par l’utilisateur.

Une fois la modification appliquée, l’événement SelectionChanged est déclenché.

Note

L’événement SelectionChanging ne se produit pas lorsque les traits sélectionnés sont supprimés ou lorsque la ActiveEditingMode propriété change.

S’applique à

Voir aussi