Partilhar via


StrokeCollection.Replace Método

Definição

Substitui os traços na coleção.

Sobrecargas

Replace(Stroke, StrokeCollection)

Substitui o Stroke especificado pelo StrokeCollection indicado.

Replace(StrokeCollection, StrokeCollection)

Substitui o StrokeCollection especificado por um novo StrokeCollection.

Replace(Stroke, StrokeCollection)

Substitui o Stroke especificado pelo StrokeCollection indicado.

public:
 void Replace(System::Windows::Ink::Stroke ^ strokeToReplace, System::Windows::Ink::StrokeCollection ^ strokesToReplaceWith);
public void Replace (System.Windows.Ink.Stroke strokeToReplace, System.Windows.Ink.StrokeCollection strokesToReplaceWith);
member this.Replace : System.Windows.Ink.Stroke * System.Windows.Ink.StrokeCollection -> unit
Public Sub Replace (strokeToReplace As Stroke, strokesToReplaceWith As StrokeCollection)

Parâmetros

strokeToReplace
Stroke

O Stroke a ser substituído.

strokesToReplaceWith
StrokeCollection

A fonte de StrokeCollection.

Exceções

strokesToReplace está vazio.

- ou -

strokesToReplaceWith está vazio.

- ou -

Um Stroke em strokesToReplaceWith já está em strokesToReplace.

Exemplos

O exemplo a seguir demonstra como substituir os traços selecionados em um InkCanvas por outro StrokeCollection. Este exemplo pressupõe que haja um InkCanvas chamado inkCanvas1.

// Replace the selected strokes with other strokes.
private void ReplaceStrokes(StrokeCollection strokes)
{
    StrokeCollection selectedStrokes = inkCanvas1.GetSelectedStrokes();

    if (selectedStrokes != null && selectedStrokes.Count > 0)
    {
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes);
    }
}
' Replace the selected strokes with other strokes.
Private Sub ReplaceStrokes(ByVal strokes As StrokeCollection)

    Dim selectedStrokes As StrokeCollection = inkCanvas1.GetSelectedStrokes()

    If Not (selectedStrokes Is Nothing) Then
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes)
    End If

End Sub

Comentários

O Replace método gera o StrokesChanged evento .

Aplica-se a

Replace(StrokeCollection, StrokeCollection)

Substitui o StrokeCollection especificado por um novo StrokeCollection.

public:
 void Replace(System::Windows::Ink::StrokeCollection ^ strokesToReplace, System::Windows::Ink::StrokeCollection ^ strokesToReplaceWith);
public void Replace (System.Windows.Ink.StrokeCollection strokesToReplace, System.Windows.Ink.StrokeCollection strokesToReplaceWith);
member this.Replace : System.Windows.Ink.StrokeCollection * System.Windows.Ink.StrokeCollection -> unit
Public Sub Replace (strokesToReplace As StrokeCollection, strokesToReplaceWith As StrokeCollection)

Parâmetros

strokesToReplace
StrokeCollection

O StrokeCollection de destino.

strokesToReplaceWith
StrokeCollection

A fonte de StrokeCollection.

Exceções

strokesToReplace está vazio.

- ou -

strokesToReplaceWith está vazio.

- ou -

Um Stroke em strokesToReplaceWith já está em strokesToReplace.

- ou -

Os traços no strokesToReplaceWith não são contínuos.

Exemplos

O exemplo a seguir demonstra como substituir os traços selecionados em um InkCanvas por outro StrokeCollection. Este exemplo pressupõe que haja um InkCanvas chamado inkCanvas1.

// Replace the selected strokes with other strokes.
private void ReplaceStrokes(StrokeCollection strokes)
{
    StrokeCollection selectedStrokes = inkCanvas1.GetSelectedStrokes();

    if (selectedStrokes != null && selectedStrokes.Count > 0)
    {
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes);
    }
}
' Replace the selected strokes with other strokes.
Private Sub ReplaceStrokes(ByVal strokes As StrokeCollection)

    Dim selectedStrokes As StrokeCollection = inkCanvas1.GetSelectedStrokes()

    If Not (selectedStrokes Is Nothing) Then
        inkCanvas1.Strokes.Replace(selectedStrokes, strokes)
    End If

End Sub

Comentários

O Replace método gera o StrokesChanged evento para cada Stroke um que ele substitui.

Aplica-se a