StrokeCollection.StrokeCollection(Stream) Constructor

Initializes a StrokeCollection from the specified Stream of Ink Serialized Format (ISF).

Namespace: System.Windows.Ink
Assembly: PresentationCore (in presentationcore.dll)

public StrokeCollection (
	Stream stream
)
public StrokeCollection (
	Stream stream
)
public function StrokeCollection (
	stream : Stream
)
You cannot use constructors in XAML.

Parameters

stream

A stream that contains ink data.

The following example demonstrates how to save and load a StrokeCollection. This example assumes that there is an InkCanvas called inkCanvas1.

    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 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();
            }
        }

    }

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show: