다음을 통해 공유


InkCanvas.Strokes 속성

정의

Stroke에서 수집한 잉크 InkCanvas 개체의 컬렉션을 가져오거나 설정합니다.

public:
 property System::Windows::Ink::StrokeCollection ^ Strokes { System::Windows::Ink::StrokeCollection ^ get(); void set(System::Windows::Ink::StrokeCollection ^ value); };
public System.Windows.Ink.StrokeCollection Strokes { get; set; }
member this.Strokes : System.Windows.Ink.StrokeCollection with get, set
Public Property Strokes As StrokeCollection

속성 값

StrokeCollection

Stroke 내에 포함된 InkCanvas 개체의 컬렉션입니다.

예제

다음 예제에서는 동일한 InkCanvasStrokeCollection 개체를 사용하는 방법을 보여 줍니다. 이 예제에서 플레이어 1과 플레이어 2는 각각 동일한 InkCanvas항목을 공유하더라도 개별 "수동 입력 표면"을 사용합니다. 이 예제에서는 클릭 이벤트가 이벤트 처리기에 switchPlayersButton_Click연결되어 있다고 가정합니다.

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

다음 예제에서는 다른 InkCanvas속성의 Strokes InkCanvas 속성을 바인딩하는 방법을 보여 줍니다.

<InkCanvas Background="LightGray" 
           Canvas.Top="0" Canvas.Left="0" 
           Height="400" Width="200" Name="ic"/>

<!-- Bind the Strokes of the second InkCavas to the first InkCanvas
     and mirror the strokes along the Y axis.-->
<InkCanvas Background="LightBlue"  
           Canvas.Top="0" Canvas.Left="200" 
           Height="400" Width="200" 
           Strokes="{Binding ElementName=ic, Path=Strokes}">
  <InkCanvas.LayoutTransform>
    <ScaleTransform ScaleX="-1" ScaleY="1" />
  </InkCanvas.LayoutTransform>
</InkCanvas>

설명

종속성 속성 정보

식별자 필드 StrokesProperty
메타 데이터 속성 설정 true 없음

적용 대상

추가 정보