StrokeCollection Konstruktoren

Definition

Initialisiert eine neue Instanz der StrokeCollection-Klasse.

Überlädt

Name Beschreibung
StrokeCollection()

Initialisiert eine neue Instanz der StrokeCollection-Klasse.

StrokeCollection(IEnumerable<Stroke>)

Initialisiert eine neue Instanz der StrokeCollection Klasse, die die angegebenen Striche enthält.

StrokeCollection(Stream)

Initialisiert ein StrokeCollection aus dem angegebenen Stream serialisierten Freihandformat (Ink Serialized Format, ISF).

StrokeCollection()

Initialisiert eine neue Instanz der StrokeCollection-Klasse.

public:
 StrokeCollection();
public StrokeCollection();
Public Sub New ()

Gilt für:

StrokeCollection(IEnumerable<Stroke>)

Initialisiert eine neue Instanz der StrokeCollection Klasse, die die angegebenen Striche enthält.

public:
 StrokeCollection(System::Collections::Generic::IEnumerable<System::Windows::Ink::Stroke ^> ^ strokes);
public StrokeCollection(System.Collections.Generic.IEnumerable<System.Windows.Ink.Stroke> strokes);
new System.Windows.Ink.StrokeCollection : seq<System.Windows.Ink.Stroke> -> System.Windows.Ink.StrokeCollection
Public Sub New (strokes As IEnumerable(Of Stroke))

Parameter

strokes
IEnumerable<Stroke>

Die Striche, die StrokeCollectionder Striche hinzugefügt werden sollen.

Gilt für:

StrokeCollection(Stream)

Initialisiert ein StrokeCollection aus dem angegebenen Stream serialisierten Freihandformat (Ink Serialized Format, ISF).

public:
 StrokeCollection(System::IO::Stream ^ stream);
public StrokeCollection(System.IO.Stream stream);
new System.Windows.Ink.StrokeCollection : System.IO.Stream -> System.Windows.Ink.StrokeCollection
Public Sub New (stream As Stream)

Parameter

stream
Stream

Ein Datenstrom, der Freihanddaten enthält.

Beispiele

Im folgenden Beispiel wird das Speichern und Laden eines StrokeCollection. In diesem Beispiel wird davon ausgegangen, dass ein aufgerufener InkCanvas Vorgang vorhanden inkCanvas1ist.

private void SaveStrokes_Click(object sender, RoutedEventArgs e)
{
    FileStream fs = null;

    try
    {
        fs = new FileStream(inkFileName, FileMode.Create);
        inkCanvas1.Strokes.Save(fs);
    }
    finally
    {
        if (fs != null)
        {
            fs.Close();
        }
    }
}
Private Sub SaveStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim fs As FileStream = Nothing

    Try
        fs = New FileStream(inkFileName, FileMode.Create)
        inkCanvas1.Strokes.Save(fs)
    Finally
        If Not fs Is Nothing Then
            fs.Close()
        End If
    End Try

End Sub
private void LoadStrokes_Click(object sender, RoutedEventArgs e)
{
    FileStream fs = null;

    if (!File.Exists(inkFileName))
    {
        MessageBox.Show("The file you requested does not exist." +
            " Save the StrokeCollection before loading it.");
        return;
    }

    try
    {
        fs = new FileStream(inkFileName,
            FileMode.Open, FileAccess.Read);
        StrokeCollection strokes = new StrokeCollection(fs);
        inkCanvas1.Strokes = strokes;
    }
    finally
    {
        if (fs != null)
        {
            fs.Close();
        }
    }
}
Private Sub LoadStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim fs As FileStream = Nothing

    If Not File.Exists(inkFileName) Then
        MessageBox.Show("The file you requested does not exist." & _
            " Save the StrokeCollection before loading it.")
        Return
    End If

    Try
        fs = New FileStream(inkFileName, _
            FileMode.Open, FileAccess.Read)
        Dim strokes As StrokeCollection = New StrokeCollection(fs)
        inkCanvas1.Strokes = strokes
    Finally
        If Not fs Is Nothing Then
            fs.Close()
        End If
    End Try


End Sub

Gilt für: