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


Stroke.Split - метод

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

Splits the Stroke object at the specified location on the Stroke object and returns the new Stroke object.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Function Split ( _
    findex As Single _
) As Stroke
'Применение
Dim instance As Stroke
Dim findex As Single
Dim returnValue As Stroke

returnValue = instance.Split(findex)
public Stroke Split(
    float findex
)
public:
Stroke^ Split(
    float findex
)
public Stroke Split(
    float findex
)
public function Split(
    findex : float
) : Stroke

Параметры

  • findex
    Тип: System.Single
    The floating point index value that represents where to split the Stroke object.

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

Тип: Microsoft.Ink.Stroke
The new Stroke object that is created as a result of calling this method.

Заметки

A floating point index is a float value that represents a location somewhere between two points in the stroke. As examples, if 0.0 is the first point in the stroke and 1.0 is the second point in the stroke, 0.5 is halfway between the first and second points. Similarly, a floating point index value of 37.25 represents a location that is 25 percent along the line between points 37 and 38 of the stroke.

When a Stroke is split, one portion of the stroke retains the Id property of the original Stroke object. The other portion of the Stroke becomes a new Stroke object with an Id property that is one greater than the highest existing Id property. If the original Stroke was in a Strokes collection (other than the Ink.Strokes), only the beginning portion remains in that collection.

Примеры

In this example, each selected Stroke object of an InkOverlay is examined. If the Stroke has at least one intersection with the rest of the Strokes collection in the Ink object, the Stroke is split at the first point of intersection.

' Access to the Strokes property returns a copy of the Strokes object.
' This copy must be implicitly (via using statement) or explicitly
' disposed of in order to avoid a memory leak.
Using allStrokes As Strokes = mInkOverlay.Ink.Strokes
    For Each S As Stroke In mInkOverlay.Selection
        ' find the intersections
        Dim intersections() As Single = S.FindIntersections(allStrokes)
        ' if we have at least 1 intersection, split the stroke
        If intersections.Length > 0 Then
            S.Split(intersections(0))
        End If
    Next
End Using
// Access to the Strokes property returns a copy of the Strokes object.
// This copy must be implicitly (via using statement) or explicitly
// disposed of in order to avoid a memory leak.
using (Strokes allStrokes = mInkOverlay.Ink.Strokes)
{
    foreach (Stroke S in mInkOverlay.Selection)
    {
        // find the intersections
        float[] intersections = S.FindIntersections(allStrokes);
        // if we have at least 1 intersection, split the stroke
        if (intersections.Length > 0)
        {
            S.Split(intersections[0]);
        }
    }
}

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

Stroke Класс

Stroke - члены

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