Bagikan melalui


Ink.CreateStrokes Method

Ink.CreateStrokes Method

Creates a Strokes collection based on specified Id properties of Stroke objects.

Definition

Visual Basic .NET Public Function CreateStrokes( _
ByVal ids() As Integer _
) As Strokes
C# public Strokes CreateStrokes(
int[] ids
);
Managed C++ public: Strokes* CreateStrokes(
int *ids __gc[]
);

Parameters

ids System.Int32[]. An array of specified Id properties for Stroke objects that exist in the Ink object. The Stroke objects with these Id values are added to a new Strokes collection. The default value is null (Nothing in Microsoft® Visual Basic® .NET).

Return Value

Microsoft.Ink.Strokes. Returns a new Strokes collection.

Exceptions

COMException Leave Site: from Ink.CreateStrokes() or Strokes.Add().
ObjectDisposedException Leave Site: The Ink object is disposed.

Remarks

If the ids parameter is null (Nothing in Microsoft® Visual Basic® .NET) or an empty array, an empty Strokes collection is created.

Examples

[C#]

This C# example creates a Strokes collection, newStrokes, from an array of Id properties of Stroke objects that populate an InkCollector object, theInkCollector.

// Declare an array of integers
int[] theStrokeIDs = new int[theInkCollector.Ink.Strokes.Count];

// Copy stroke IDs into the array
for (int index = 0; index < theStrokeIDs.Length; index++)
{
  theStrokeIDs[index] = theInkCollector.Ink.Strokes[index].Id;
}

// Create a new collection using the array of stroke IDs
Strokes newStrokes = theInkCollector.Ink.CreateStrokes(theStrokeIDs);

[Visual Basic .NET]

This Visual Basic .NET example creates a Strokes collection, newStrokes, from an array of Id properties of Stroke objects that populate an InkCollector object, theInkCollector.

' Declare an array of Integers
Dim theStrokeIDs(theInkCollector.Ink.Strokes.Count - 1) As Integer

' Copy stroke IDs into the array
Dim index As Integer
For index = 0 To (theInkCollector.Ink.Strokes.Count - 1)
    theStrokeIDs(index) = theInkCollector.Ink.Strokes(index).Id
Next

' Create a new collection using the array of stroke IDs
Dim newStrokes As Strokes
newStrokes = theInkCollector.Ink.CreateStrokes(theStrokeIDs)

See Also