Partilhar via


InkCanvas.Strokes Propriedade

Definição

Obtém ou define a coleção de objetos Stroke de tinta coletados pelo 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

Valor da propriedade

StrokeCollection

A coleção de objetos Stroke contida em InkCanvas.

Exemplos

O exemplo a seguir demonstra como usar dois StrokeCollection objetos para o mesmo InkCanvas. Neste exemplo, o jogador um e o jogador dois usam uma "superfície de tinta" individual, mesmo que compartilhem o mesmo InkCanvas. Este exemplo pressupõe que o evento de clique esteja conectado ao manipulador de eventos. 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

O exemplo a seguir demonstra como associar a Strokes propriedade de um InkCanvas a outro 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>

Comentários

Informações da propriedade de dependência

Campo identificador StrokesProperty
Propriedades de metadados definidas como true Nenhum

Aplica-se a

Confira também