Stroke オブジェクトを Strokes コレクションに追加します。
名前空間 : Microsoft.Ink
アセンブリ : Microsoft.Ink (Microsoft.Ink.dll 内)
構文
'宣言
Public Function Add ( _
stroke As Stroke _
) As Integer
'使用
Dim instance As Strokes
Dim stroke As Stroke
Dim returnValue As Integer
returnValue = instance.Add(stroke)
public int Add(
Stroke stroke
)
public:
int Add(
Stroke^ stroke
)
public int Add(
Stroke stroke
)
public function Add(
stroke : Stroke
) : int
パラメータ
- stroke
型 : Microsoft.Ink.Stroke
Strokes コレクションに追加する Stroke。
戻り値
型 : System.Int32
このメソッドは常に -1 の値を返します。
解説
Stroke オブジェクトは Ink オブジェクト内に存在している必要があり、別の Ink オブジェクトに属すことはできません。さらに、このメソッドは Ink オブジェクトのコピーや変更は行わず、単にこの Stroke を Strokes コレクションに追加するだけです。Strokes コレクションに既に含まれている Stroke オブジェクトを使用してこのメソッド呼び出した場合、この Stroke オブジェクトは再度追加されることはなく、また例外も発生しません。
例
この例では、新しく作成された Strokes コレクションに Stroke オブジェクトが追加されます。次に、このコレクションがさらに別の Strokes コレクションに追加されます。この例のメソッドに渡される Ink オブジェクトは、新しい Strokes コレクションと、新しい Stroke オブジェクトを作成するために使用されます。CreateStroke メソッドを呼び出して新しい Stroke オブジェクトを作成すると、新しく作成した Stroke が Ink オブジェクトのメインの Strokes() コレクションに自動的に追加されます。さらに、この例で示すように、新しく作成した Stroke オブジェクトを別の Strokes コレクションに追加することもできます。
Private Sub AddStrokes(ByVal mInk As Ink)
' create a new Strokes collection
Dim newStrokes1 As Strokes = mInk.CreateStrokes()
' create a new Stroke
Dim points As Point() = {New Point(500, 500), New Point(500, 2500)}
Dim newStroke As Stroke = mInk.CreateStroke(points)
' add the new Stroke to the Strokes collection
newStrokes1.Add(newStroke)
' create another Strokes collection
Dim newStrokes2 As Strokes = mInk.CreateStrokes()
' add the first Strokes collection to the second Strokes collection
newStrokes2.Add(newStrokes1)
End Sub
private void AddStrokes(Ink mInk)
{
// create a new Strokes collection
Strokes newStrokes1 = mInk.CreateStrokes();
// create a new Stroke
Point[] points = { new Point(500, 500), new Point(500, 2500) };
Stroke newStroke = mInk.CreateStroke(points);
// add the new Stroke to the Strokes collection
newStrokes1.Add(newStroke);
// create another Strokes collection
Strokes newStrokes2 = mInk.CreateStrokes();
// add the first Strokes collection to the second Strokes collection
newStrokes2.Add(newStrokes1);
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0