次の方法で共有


CustomStrokes.Item プロパティ (String)

CustomStrokes コレクション内で、指定した名前の Strokes コレクションを取得します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public ReadOnly Property Item ( _
    name As String _
) As Strokes
'使用
Dim instance As CustomStrokes
Dim name As String
Dim value As Strokes

value = instance.Item(name)
public Strokes Item[
    string name
] { get; }
public:
property Strokes^ Item[String^ name] {
    Strokes^ get (String^ name);
}
/** @property */
public Strokes get_Item(
    String name
)
JScript では、インデックス付きプロパティはサポートされません。

パラメータ

プロパティ値

型 : Microsoft.Ink.Strokes
CustomStrokes コレクション内の指定した Strokes コレクション。

解説

name が CustomStrokes コレクションの既存のメンバと一致しない場合は System.ArgumentException が発生します。

ms582083.alert_note(ja-jp,VS.90).gifメモ :

C# では、次の例に示すように、コレクションの Item プロパティを使用する代わりに、コレクションのインデクサを使用します。

この例では、Ink オブジェクトの CustomStrokes コレクションに、指定された名前を持つ Strokes コレクションが含まれている場合に、メソッドが true を返します。指定された名前を持つ Strokes コレクションが存在しない場合は、例外が発生し、メソッドが false を返します。

Private Function CustomStrokesCollectionExists(ByVal mName As String, ByVal mInk As Ink) As Boolean
    Try
        Dim S As Strokes = mInk.CustomStrokes(mName)
        ' In VB, you can also access the named collections by using the Item property:
        ' Dim S As Strokes = mInk.CustomStrokes.Item(mName)
        '
        ' if the previous statement did not raise an exception, 
        ' the named Strokes collection exists
        Return True

    Catch E As ArgumentException
        ' this exception is raised when the named collection does not exist

    Catch E As Exception
        ' in case another type of exception is raised

    End Try
    Return False
End Function
private bool CustomStrokesCollectionExists(string mName, Ink mInk)
{
    try
    {
        Strokes S = mInk.CustomStrokes[mName];
        // In C#, the Item property is not available. The following won't compile:
        // Strokes S = mInk.CustomStrokes.Item[mName];

        // if the previous statement did not throw an exception, 
        // the named Strokes collection exists
        return true;
    }
    catch (ArgumentException)
    {
        // this exception is raised when the named collection does not exist
    }
    catch (Exception)
    {
        // in case another type of exception is raised
    }
    return false;
}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

CustomStrokes クラス

CustomStrokes メンバ

Item オーバーロード

Microsoft.Ink 名前空間

Item

Strokes