Поделиться через


Strokes.Add - метод (Stroke)

Обновлен: Ноябрь 2007

Adds a Stroke object to the Strokes collection.

Пространство имен:  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

Параметры

Возвращаемое значение

Тип: System.Int32
This method always returns a value of -1.

Заметки

The Stroke object must already exist within the Ink object and cannot belong to another Ink object. In addition, this method does not copy or otherwise alter the Ink object, but merely adds this Stroke to the Strokes collection. If you call this method with a Stroke object that is already contained in the Strokes collection, the Stroke object will not be added again, and no exception will be raised.

Примеры

In this example, a Stroke object is added to a newly created Strokes collection. This collection in turn is added to another Strokes collection. The Ink object passed to the example method is used to create new Strokes collections, and new Stroke objects. When you create a new Stroke object by calling the CreateStroke method, the newly created Stroke is automatically added to the main Strokes() collection of the Ink object. In addtion, as shown in this example, the newly created Stroke object can be added to other Strokes collections.

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

См. также

Ссылки

Strokes Класс

Strokes - члены

Add - перегрузка

Microsoft.Ink - пространство имен

Stroke

Strokes