InkCanvas.SelectionChanging Zdarzenie

Definicja

Występuje, gdy jest wybierany nowy zestaw pociągnięć pisma odkowego i/lub elementów.

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 

Typ zdarzenia

Przykłady

W poniższym przykładzie wybrane pociągnięcia są niebieskie.

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

Uwagi

Zdarzenie SelectionChanging jest wywoływane, gdy użytkownik wybiera pociągnięcia i/lub elementy, ale przed zastosowaniem zmiany.

Zdarzenie SelectionChanging jest przetwarzane po odebraniu InkCanvasSelectionChangingEventHandlerInkCanvasSelectionChangingEventArgs obiektu. InkCanvasSelectionChangingEventArgs Udostępnia metody uzyskiwania FrameworkElement dostępu do obiektów i StrokeCollection po wybraniu ich przez użytkownika.

Po zastosowaniu SelectionChanged zmiany zdarzenie jest zgłaszane.

Uwaga

Zdarzenie SelectionChanging nie występuje po usunięciu wybranych pociągnięć lub zmianie ActiveEditingMode właściwości.

Dotyczy

Zobacz też