Condividi tramite


Metodo Strokes.Add (Stroke)

Aggiornamento: novembre 2007

Aggiunge un oggetto Stroke all'insieme Strokes.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Function Add ( _
    stroke As Stroke _
) As Integer
'Utilizzo
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

Parametri

Valore restituito

Tipo: System.Int32
Il metodo restituisce sempre un valore pari a -1.

Note

L'oggetto Stroke deve già esistere all'interno dell'oggetto Ink e non può appartenere a un altro oggetto Ink. Inoltre, questo metodo non copia né modifica l'oggetto Ink, ma aggiunge semplicemente questo oggetto Stroke all'insieme Strokes. Se si chiama questo metodo con un oggetto Stroke che è già contenuto nell'insieme Strokes, l'oggetto Stroke non sarà aggiunto di nuovo e non sarà generata alcuna eccezione.

Esempi

In questo esempio, un oggetto Stroke viene aggiunto a un insieme Strokes appena creato. Questo insieme viene aggiunto a sua volta a un altro insieme Strokes. L'oggetto Ink passato al metodo di esempio viene utilizzato per creare insiemi Strokes nuovi e oggetti Stroke nuovi. Quando si crea un nuovo oggetto Stroke chiamando il metodo CreateStroke, l'oggetto Stroke appena creato viene aggiunto automaticamente all'insieme Strokes() principale dell'oggetto Ink. Inoltre, come illustrato in questo esempio, l'oggetto Stroke appena creato può essere aggiunto ad altri insiemi 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);
}

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

Strokes Classe

Membri Strokes

Overload Add

Spazio dei nomi Microsoft.Ink

Stroke

Strokes