共用方式為


Ink.DeleteStroke 方法

Stroke 物件從 Ink 物件中刪除。

命名空間:  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 物件。接著會在 Stroke 物件的點數比 maxPointCount 多時,刪除物件。

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