StrokeCollection 생성자

정의

StrokeCollection 클래스의 새 인스턴스를 초기화합니다.

오버로드

StrokeCollection()

StrokeCollection 클래스의 새 인스턴스를 초기화합니다.

StrokeCollection(IEnumerable<Stroke>)

지정한 스트로크를 포함하는 StrokeCollection 클래스의 새 인스턴스를 초기화합니다.

StrokeCollection(Stream)

ISF(Serialize된 잉크 형식)의 지정한 StrokeCollection에서 Stream을 초기화합니다.

StrokeCollection()

StrokeCollection 클래스의 새 인스턴스를 초기화합니다.

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

적용 대상

StrokeCollection(IEnumerable<Stroke>)

지정한 스트로크를 포함하는 StrokeCollection 클래스의 새 인스턴스를 초기화합니다.

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))

매개 변수

strokes
IEnumerable<Stroke>

StrokeCollection에 추가할 스트로크입니다.

적용 대상

StrokeCollection(Stream)

ISF(Serialize된 잉크 형식)의 지정한 StrokeCollection에서 Stream을 초기화합니다.

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)

매개 변수

stream
Stream

잉크 데이터가 들어 있는 스트림입니다.

예제

다음 예제에서는 저장 및 로드 하는 방법을 보여 줍니다는 StrokeCollection합니다. 이 예제에서는 있다고 가정를 InkCanvas 호출 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 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

적용 대상