Ink.CreateStrokes 方法 (array<Int32[])

根据 Stroke 对象的指定 Id 属性创建 Strokes 集合。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Function CreateStrokes ( _
    ids As Integer() _
) As Strokes
用法
Dim instance As Ink
Dim ids As Integer()
Dim returnValue As Strokes

returnValue = instance.CreateStrokes(ids)
public Strokes CreateStrokes(
    int[] ids
)
public:
Strokes^ CreateStrokes(
    array<int>^ ids
)
public Strokes CreateStrokes(
    int[] ids
)
public function CreateStrokes(
    ids : int[]
) : Strokes

参数

  • ids
    类型:array<System.Int32[]
    Ink 对象中存在的 Stroke 对象的指定 Id 属性所组成的数组。将具有这些 Id 值的 Stroke 对象添加到新 Strokes 集合。默认值为 nullnull 引用(在 Visual Basic 中为 Nothing)(在 Microsoft Visual Basic.NET 中为 Nothing)。

返回值

类型:Microsoft.Ink.Strokes
返回新的 Strokes 集合。

备注

如果 ids 参数为 nullnull 引用(在 Visual Basic 中为 Nothing)(在 Visual Basic .NET 中为 Nothing)或空数组,则创建空 Strokes 集合。

示例

在此示例中,根据 Id 属性数组创建新 Strokes 集合。通过检查每个当前与 InkOverlay 对象关联的 Stroke 对象获取 Id 属性。

' Access to the Ink.Strokes property returns a copy of the Strokes object.
' This copy must be implicitly (via using statement) or explicitly
' disposed of in order to avoid a memory leak.
Using currentStrokes As Strokes = mInkOverlay.Ink.Strokes
    ' Declare an array of integers
    Dim theStrokeIDs(currentStrokes.Count - 1) As Integer
    ' Copy stroke IDs into the array
    For k As Integer = 0 To currentStrokes.Count - 1
        theStrokeIDs(k) = currentStrokes(k).Id
    Next
    ' Create a new collection using the array of stroke IDs
    Dim newStokes As Strokes = mInkOverlay.Ink.CreateStrokes(theStrokeIDs)
End Using
// Access to the Ink.Strokes property returns a copy of the Strokes object.
// This copy must be implicitly (via using statement) or explicitly
// disposed of in order to avoid a memory leak.
using (Strokes currentStrokes = mInkOverlay.Ink.Strokes)
{
    // Declare an array of integers
    int[] theStrokeIDs = new int[currentStrokes.Count];

    // Copy stroke IDs into the array
    for (int k = 0; k < currentStrokes.Count; k++)
    {
        theStrokeIDs[k] = currentStrokes[k].Id;
    }
    // Create a new collection using the array of stroke IDs
    Strokes newStrokes = mInkOverlay.Ink.CreateStrokes(theStrokeIDs);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Ink 类

Ink 成员

CreateStrokes 重载

Microsoft.Ink 命名空间

Strokes

Ink.CreateStroke

Ink.DeleteStroke

Ink.DeleteStrokes