InkCanvas.SelectionChanging Evento

Definição

Ocorre quando um novo conjunto de traços de tinta e/ou elementos está a ser selecionado.

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 de Evento

Exemplos

O exemplo seguinte faz com que traços selecionados sejam azul 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

Observações

O SelectionChanging evento é ativado quando traços e/ou elementos são selecionados pelo utilizador – mas antes de a alteração ser aplicada.

O SelectionChanging evento é processado quando recebe InkCanvasSelectionChangingEventHandler um InkCanvasSelectionChangingEventArgs objeto. InkCanvasSelectionChangingEventArgs fornece métodos para aceder FrameworkElement a objetos StrokeCollection após serem selecionados pelo utilizador.

Após a alteração ser aplicada, o SelectionChanged evento é levantado.

Note

O SelectionChanging evento não ocorre quando os traços selecionados são eliminados ou quando a ActiveEditingMode propriedade muda.

Aplica-se a

Ver também