次の方法で共有


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
)

パラメータ

解説

このメソッドは、1 つの 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