InkCanvas.StrokesReplaced 이벤트

정의

Strokes 속성이 바뀔 때 발생합니다.Occurs when the Strokes property is replaced.

public:
 event System::Windows::Controls::InkCanvasStrokesReplacedEventHandler ^ StrokesReplaced;
public event System.Windows.Controls.InkCanvasStrokesReplacedEventHandler StrokesReplaced;
member this.StrokesReplaced : System.Windows.Controls.InkCanvasStrokesReplacedEventHandler 
Public Custom Event StrokesReplaced As InkCanvasStrokesReplacedEventHandler 
Public Event StrokesReplaced As InkCanvasStrokesReplacedEventHandler 

이벤트 유형

InkCanvasStrokesReplacedEventHandler

예제

다음 예제에서는 StrokeCollection 동일한에 같은 위치에 배치 된 두 개체를 사용 하는 방법을 보여 줍니다 InkCanvas .The following example demonstrates how to use two StrokeCollection objects that are co-located on the same InkCanvas. 이 예제에서 플레이어 1과 플레이어는 모두 동일한를 공유 하더라도 개별 "잉크 화면"을 사용 InkCanvas 합니다.In this example, player one and player two each use an individual "inking surface" even though they share the same InkCanvas. 이 예에서는 switchPlayersButton_Click 이벤트가 이벤트 처리기에 연결 된 것으로 가정 합니다.This example assumes that the switchPlayersButton_Click event is connected to the event handler.

StrokeCollection player1;
StrokeCollection player2;

void InitializePlayersCanvases()
{
    player1 = inkCanvas1.Strokes;
    player2 = new StrokeCollection();
}

// Use a different "inking surface" for each player.
void switchPlayersButton_Click(object sender, RoutedEventArgs e)
{
    if (StrokeCollection.ReferenceEquals(inkCanvas1.Strokes, player1))
    {
        inkCanvas1.Strokes = player2;
    }
    else
    {
        inkCanvas1.Strokes = player1;
    }
}

void inkCanvas1_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
{
    if (StrokeCollection.ReferenceEquals(e.NewStrokes, player1))
    {
        Title = "Player one's turn";
    }
    else
    {
        Title = "Player two's turn";
    }
}
Private player1 As StrokeCollection
Private player2 As StrokeCollection


Sub InitializePlayersCanvases()

    player1 = inkCanvas1.Strokes
    player2 = New StrokeCollection()

End Sub


' Use a different "inking surface" for each player.
Private Sub switchPlayersButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    If StrokeCollection.ReferenceEquals(inkCanvas1.Strokes, player1) Then
        inkCanvas1.Strokes = player2
    Else
        inkCanvas1.Strokes = player1
    End If

End Sub


Private Sub inkCanvas1_StrokesReplaced(ByVal sender As Object, _
                               ByVal e As InkCanvasStrokesReplacedEventArgs)

    If StrokeCollection.ReferenceEquals(e.NewStrokes, player1) Then
        Title = "Player one's turn"
    Else
        Title = "Player two's turn"
    End If

End Sub

적용 대상