InkCanvas.SelectionChanging Evento
Definição
Ocorre quando um novo conjunto de elementos e/ou traços de tinta está sendo selecionado.Occurs when a new set of ink strokes and/or elements is being selected.
public:
event System::Windows::Controls::InkCanvasSelectionChangingEventHandler ^ SelectionChanging;
public event System.Windows.Controls.InkCanvasSelectionChangingEventHandler SelectionChanging;
member this.SelectionChanging : System.Windows.Controls.InkCanvasSelectionChangingEventHandler
Public Event SelectionChanging As InkCanvasSelectionChangingEventHandler
Exemplos
O exemplo a seguir torna os traços selecionados Royal azul.The following example makes selected strokes royal blue.
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
Comentários
O SelectionChanging evento é gerado quando os elementos Strokes e/ou são selecionados pelo usuário, mas antes da alteração ser aplicada.The SelectionChanging event is raised when strokes and/or elements are selected by the user - but before the change is applied.
O SelectionChanging evento é processado quando o InkCanvasSelectionChangingEventHandler recebe um InkCanvasSelectionChangingEventArgs objeto.The SelectionChanging event is processed when the InkCanvasSelectionChangingEventHandler receives an InkCanvasSelectionChangingEventArgs object. InkCanvasSelectionChangingEventArgsfornece métodos para acessar FrameworkElement e StrokeCollection objetos depois que eles são selecionados pelo usuário.InkCanvasSelectionChangingEventArgs provides methods for accessing FrameworkElement and StrokeCollection objects after they are selected by the user.
Depois que a alteração é aplicada, SelectionChanged o evento é gerado.After the change is applied, the SelectionChanged event is raised.
Observação
O SelectionChanging evento não ocorre quando os traços selecionados são excluídos ou quando a ActiveEditingMode propriedade é alterada.The SelectionChanging event does not occur when the selected strokes are deleted or when the ActiveEditingMode property changes.