InkCanvas.SelectionChanging 이벤트

정의

새 잉크 스트로크 및/또는 요소 집합이 선택될 때 발생합니다.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 Custom Event SelectionChanging As InkCanvasSelectionChangingEventHandler 
Public Event SelectionChanging As InkCanvasSelectionChangingEventHandler 

이벤트 유형

InkCanvasSelectionChangingEventHandler

예제

다음 예에서는 선택한 스트로크를 선명한 파랑으로 만듭니다.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

설명

SelectionChanging이 이벤트는 사용자가 스트로크 및/또는 요소를 선택 하 고 변경 내용을 적용 하기 전에 발생 합니다.The SelectionChanging event is raised when strokes and/or elements are selected by the user - but before the change is applied.

SelectionChanging이벤트는에서 개체를 받을 때 처리 됩니다 InkCanvasSelectionChangingEventHandler InkCanvasSelectionChangingEventArgs .The SelectionChanging event is processed when the InkCanvasSelectionChangingEventHandler receives an InkCanvasSelectionChangingEventArgs object. InkCanvasSelectionChangingEventArgsFrameworkElement StrokeCollection 사용자가 및 개체를 선택한 후 해당 개체에 액세스할 수 있는 메서드를 제공 합니다.InkCanvasSelectionChangingEventArgs provides methods for accessing FrameworkElement and StrokeCollection objects after they are selected by the user.

변경이 적용 되 면 SelectionChanged 이벤트가 발생 합니다.After the change is applied, the SelectionChanged event is raised.

참고

SelectionChanging 이벤트는 선택한 스트로크를 삭제 하거나 속성이 변경 될 때 발생 하지 않습니다 ActiveEditingMode .The SelectionChanging event does not occur when the selected strokes are deleted or when the ActiveEditingMode property changes.

적용 대상

추가 정보