Ink.DeleteStroke 方法

Ink 对象删除 Stroke 对象。

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

语法

声明
Public Sub DeleteStroke ( _
    stroke As Stroke _
)
用法
Dim instance As Ink
Dim stroke As Stroke

instance.DeleteStroke(stroke)
public void DeleteStroke(
    Stroke stroke
)
public:
void DeleteStroke(
    Stroke^ stroke
)
public void DeleteStroke(
    Stroke stroke
)
public function DeleteStroke(
    stroke : Stroke
)

参数

备注

此方法仅删除单个 Stroke 对象。若要删除 Strokes 集合,请调用 DeleteStrokes 方法。

如果在用户主动绘制墨迹 时调用,此方法将导致错误。

示例

此示例创建一个示例方法,该方法使用 foreach 循环来循环访问 Ink 对象中包含的 Stroke 对象。然后,该方法删除任何点数量超过 maxPointCount 的 Stroke 对象。

Private Sub DeleteStrokesByPointCount(ByVal theInk As Ink, ByVal maxPointCount As Integer)
    ' Access to the 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 = theInk.Strokes
        For Each S As Stroke In currentStrokes
            If S.PacketCount > maxPointCount Then
                theInk.DeleteStroke(S)
            End If
        Next
    End Using
End Sub
private void DeleteStrokesByPointCount(Ink theInk, int maxPointCount)
{
    // Access to the 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 = theInk.Strokes)
    {
        foreach (Stroke S in currentStrokes)
        {
            if (S.PacketCount > maxPointCount)
            {
                theInk.DeleteStroke(S);
            }
        }
    }
}

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Ink 类

Ink 成员

Microsoft.Ink 命名空间

Stroke

Ink.DeleteStrokes

Ink.CreateStroke

Ink.CreateStrokes