CustomStrokes.Item 属性 (Int32)
获取 CustomStrokes 集合中指定索引处的 Strokes 集合。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public ReadOnly Property Item ( _
index As Integer _
) As Strokes
用法
Dim instance As CustomStrokes
Dim index As Integer
Dim value As Strokes
value = instance.Item(index)
public Strokes Item[
int index
] { get; }
public:
property Strokes^ Item[int index] {
Strokes^ get (int index);
}
/** @property */
public Strokes get_Item(
int index
)
JScript 不支持索引属性。
参数
- index
类型:System.Int32
要获取的 Strokes 集合的从零开始的索引。
属性值
类型:Microsoft.Ink.Strokes
CustomStrokes 集合中的指定的 Strokes 集合。
备注
如果 index 与 CustomStrokes 集合的现有成员不匹配,则会引发 System.ArgumentOutOfRangeException。如果出于开发目的正在使用安装了 Tablet PC SDK 的 Windows XP(非 Tablet 版本),并且 index 与 CustomStrokes 集合的现有成员不匹配,则会引发 System.Runtime.Inter。
备注
在 C# 中,应按下例所示使用该集合的索引器,而不是使用该集合的 Item 属性。
示例
在此示例中,如果 Ink 对象的 CustomStrokes 集合在指定索引处包含 Strokes 集合,则方法返回 true。如果指定索引处没有 Strokes 集合,则会引发异常,并且方法返回 false。
Private Function CustomStrokesCollectionExists(ByVal mIndex As Integer, ByVal mInk As Ink) As Boolean
Try
Dim S As Strokes = mInk.CustomStrokes(mIndex)
' In VB, you can also access the named collections by using the Item property:
' Dim S As Strokes = mInk.CustomStrokes.Item(mIndex)
'
' if the previous statement did not raise an exception,
' the indexed Strokes collection exists
Return True
Catch E As System.Runtime.InteropServices.COMException
' For Windows XP (not Tablet Edition) with Tablet PC SDK installed for development purposes
' this exception is raised when the indexed collection does not exist
Catch E As ArgumentOutOfRangeException
' For Windows XP Tablet Edition and Vista
' this exception is raised when the indexed 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(int mIndex, Ink mInk)
{
try
{
Strokes S = mInk.CustomStrokes[mIndex];
// In C#, the Item property is not available. The following won't compile:
// Strokes S = mInk.CustomStrokes.Item[mIndex];
// if the previous statement did not throw an exception,
// the indexed Strokes collection exists
return true;
}
catch (System.Runtime.InteropServices.COMException)
{
// For Windows XP (not Tablet Edition) with Tablet PC SDK installed for development purposes
// this exception is raised when the indexed collection does not exist
}
catch (ArgumentOutOfRangeException)
{
// For Windows XP Tablet Edition and Vista
// this exception is raised when the indexed 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