Språk

StrokeCollection.Add(StrokeCollection) Metod

Definition

Lägger till de angivna linjerna i StrokeCollection.

public:
 void Add(System::Windows::Ink::StrokeCollection ^ strokes);
public void Add(System.Windows.Ink.StrokeCollection strokes);
override this.Add : System.Windows.Ink.StrokeCollection -> unit
Public Sub Add (strokes As StrokeCollection)

Parametrar

strokes
StrokeCollection

Att StrokeCollection lägga till i samlingen.

Undantag

En Stroke in strokes är redan medlem i StrokeCollection.

strokes är null.

Exempel

I följande exempel visas hur du kopierar pennanteckningen i ett till ett InkCanvas annat InkCanvas. Det här exemplet förutsätter:

  • Det finns två InkCanvas objekt som heter inkCanvas1 och inkCanvas2.

  • Händelsen Click har anslutits till händelsehanteraren.

// Copy the strokes from one InkCanvas to another InkCanvas.
private void CopyStrokes_Click(object sender, RoutedEventArgs e) 
{
    StrokeCollection strokes = inkCanvas1.Strokes.Clone();
    inkCanvas2.Strokes.Clear();
    inkCanvas2.Strokes.Add(strokes);
}
' Copy the strokes from one InkCanvas to another InkCanvas.
Private Sub CopyStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim strokes As StrokeCollection = inkCanvas1.Strokes.Clone()
    inkCanvas2.Strokes.Clear()
    inkCanvas2.Strokes.Add(strokes)

End Sub

Kommentarer

Metoden Add genererar StrokesChanged händelsen.

Gäller för