StylusPointCollection.Clone Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Returns
A new StylusPointCollection that contains copies of the StylusPoint objects in the current StylusPointCollection.
Examples
The following example demonstrates how to copy a StylusPointCollection. The example creates a stroke comprised of members of the StylusPointCollection and adds them to an InkCanvas. 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)
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET