다음을 통해 공유


Strokes.Add 메서드 (Stroke)

업데이트: 2007년 11월

Strokes 컬렉션에 Stroke 개체를 추가합니다.

네임스페이스:  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
이 메서드는 항상 -1 값을 반환합니다.

설명

Stroke 개체는 이미 Ink 개체 내에 있어야 하며 다른 Ink 개체에 속할 수 없습니다. 또한 이 메서드는 Ink 개체를 복사하거나 어떠한 방식으로도 변경하지 않으며 해당 StrokeStrokes 컬렉션에 단순히 추가하기만 합니다. 이미 Strokes 컬렉션에 들어 있는 Stroke 개체를 사용하여 이 메서드를 호출하면 Stroke 개체가 다시 추가되지 않고 예외가 발생합니다.

예제

이 예제에서는 새로 만든 Strokes 컬렉션에 Stroke 개체를 추가합니다. 그런 다음 이 컬렉션을 다른 Strokes 컬렉션에 추가합니다. 예제 메서드에 전달된 Ink 개체는 새 Strokes 컬렉션 및 새 Stroke 개체를 만드는 데 사용됩니다. CreateStroke 메서드를 호출하여 새 Stroke 개체를 만들면 새로 만든 StrokeInk 개체의 기본 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에서 지원

참고 항목

참조

Strokes 클래스

Strokes 멤버

Add 오버로드

Microsoft.Ink 네임스페이스

Stroke

Strokes