StylusPointCollection.Clone 메서드

정의

StylusPointCollection을 복사합니다.Copies the StylusPointCollection.

public:
 System::Windows::Input::StylusPointCollection ^ Clone();
public System.Windows.Input.StylusPointCollection Clone ();
member this.Clone : unit -> System.Windows.Input.StylusPointCollection
Public Function Clone () As StylusPointCollection

반환

현재 StylusPointCollection에 있는 StylusPoint 개체의 복사본이 포함된 새 StylusPointCollection입니다.A new StylusPointCollection that contains copies of the StylusPoint objects in the current StylusPointCollection.

예제

다음 예제에서는 복사 하는 방법에 설명 된 StylusPointCollection합니다.The following example demonstrates how to copy a StylusPointCollection. 예의 멤버로 구성 된 스트로크를 만들어 합니다 StylusPointCollection 에 추가 합니다는 InkCanvas합니다.The example creates a stroke comprised of members of the StylusPointCollection and adds them to an InkCanvas. 이 예제에서는 있다고 가정를 InkCanvas 호출 inkcanvs1합니다.This example assumes that there is an InkCanvas called inkcanvs1.

Point[] rawPoints = new Point[]
    {
        new Point(100, 100),
        new Point(100, 200),
        new Point(200, 250),
        new Point(300, 300)
    };

StylusPointCollection points1 = new StylusPointCollection(rawPoints);

// Create a copy of points1 and change the second StylusPoint.
StylusPointCollection points2 = points1.Clone();
points2[1] = new StylusPoint(200, 100);

// Create a stroke from each StylusPointCollection and add them to
// inkCanvas1. Note that changing a StylusPoint in point2 did not
// affect points1.
Stroke stroke1 = new Stroke(points1);
inkCanvas1.Strokes.Add(stroke1);

Stroke stroke2 = new Stroke(points2);
stroke2.DrawingAttributes.Color = Colors.Red;
inkCanvas1.Strokes.Add(stroke2);
Dim rawPoints() As Point = {New Point(100, 100), _
                            New Point(100, 200), _
                            New Point(200, 250), _
                            New Point(300, 300)}

Dim points1 As New StylusPointCollection(rawPoints)

' Create a copy of points1 and change the second StylusPoint.
Dim points2 As StylusPointCollection = points1.Clone()
points2(1) = New StylusPoint(200, 100)

' Create a stroke from each StylusPointCollection and add them to
' inkCanvas1. Note that changing a StylusPoint in point2 did not
' affect points1.
Dim stroke1 As New Stroke(points1)
inkCanvas1.Strokes.Add(stroke1)

Dim stroke2 As New Stroke(points2)
stroke2.DrawingAttributes.Color = Colors.Red
inkCanvas1.Strokes.Add(stroke2)

적용 대상