다음을 통해 공유


StrokeIntersection.BeginIndex 속성

업데이트: 2007년 11월

StrokeIntersection 구조체의 시작점을 가져오거나 설정합니다.

네임스페이스:  Microsoft.Ink
어셈블리:  Microsoft.Ink(Microsoft.Ink.dll)

구문

‘선언
Public Property BeginIndex As Single
‘사용 방법
Dim instance As StrokeIntersection
Dim value As Single

value = instance.BeginIndex

instance.BeginIndex = value
public float BeginIndex { get; set; }
public:
property float BeginIndex {
    float get ();
    void set (float value);
}
/** @property */
public float get_BeginIndex()
/** @property */
public  void set_BeginIndex(float value)
public function get BeginIndex () : float
public function set BeginIndex (value : float)

속성 값

형식: System.Single
교차가 시작되는 부동 소수점 인덱스입니다.

설명

스트로크가 교차된 영역 내에서 시작되는 경우 이 값은 -1입니다.

부동 소수점 인덱스는 스트로크의 두 점 사이에 있는 위치를 나타내는 부동 소수점 값입니다. 예를 들어 스트로크에서 첫 번째 점이 0.0이고 두 번째 점이 1.0인 경우 0.5는 첫 번째 점과 두 번째 점 사이의 중간 지점입니다. 마찬가지로 부동 소수점 인덱스 값 37.25는 스트로크의 37번과 38번 점 사이의 선에서 25% 위치를 나타냅니다.

예제

이 예제에서는 전달된 Stroke 개체의 세그먼트 중 지정된 Rectangle 구조체 안에 있는 모든 세그먼트가 삭제됩니다. 이를 위해 StrokeIntersection 구조체를 조사하여 전달된 Stroke 개체를 분할할 위치 및 삭제할 세그먼트를 확인합니다.

Private Sub DeleteInsideRectangle(ByVal S As Stroke, ByVal R As Rectangle)
    ' get the StrokeIntersection array
    Dim SI() As StrokeIntersection = S.GetRectangleIntersections(R)
    ' examine each StrokeIntersection
    ' must work backwards through the array so that when splitting, 
    ' the remaining intersections are still valid for S
    For k As Integer = SI.Length - 1 To 0 Step -1

        Dim enterRect As Single = SI(k).BeginIndex
        Dim exitRect As Single = SI(k).EndIndex

        ' check if the whole stroke is inside the rectangle
        ' if so, delete the stroke
        If enterRect = -1 And exitRect = -1 Then
            S.Ink.DeleteStroke(S)
            Continue For
        End If

        ' check if a segment enters and exits the rectangle
        ' if so, split and delete the segment inside the rectangle
        If enterRect > 0 And exitRect > 0 Then
            ' the stroke resulting from split() is outside, keep it
            S.Split(exitRect)
            ' the stroke from this split() is inside, delete it
            Dim temp As Stroke = S.Split(enterRect)
            temp.Ink.DeleteStroke(temp)
            Continue For
        End If

        ' check if stroke starts inside the rectangle and goes outside
        ' if so, split and delete the segment inside the rectangle
        If enterRect = -1 And exitRect > 0 Then
            ' the stroke resulting from split() is outside, keep it
            S.Split(exitRect)
            ' delete the remaining segment of the stroke
            S.Ink.DeleteStroke(S)
            Continue For
        End If

        ' check if stroke starts outside the rectangle and ends inside
        ' if so, split and delete the segment inside the rectangle
        If enterRect > 0 And exitRect = -1 Then
            Dim temp2 As Stroke = S.Split(enterRect)
            temp2.Ink.DeleteStroke(temp2)
        End If
    Next
End Sub
private void DeleteInsideRectangle(Stroke S, Rectangle R)
{
    // get the StrokeIntersection array
    StrokeIntersection[] SI = S.GetRectangleIntersections(R);

    // examine each StrokeIntersection
    // must work backwards through the array so that when splitting, 
    // the remaining intersections are still valid for S
    for (int k = SI.Length - 1; k >= 0; k--)
    {
        float enterRect = SI[k].BeginIndex;
        float exitRect = SI[k].EndIndex;

        // check if the whole stroke is inside the rectangle
        // if so, delete the stroke
        if (enterRect == -1 && exitRect == -1)
        {
            S.Ink.DeleteStroke(S);
            continue;
        }

        // check if a segment enters and exits the rectangle
        // if so, split and delete the segment inside the rectangle
        if (enterRect > 0 && exitRect > 0)
        {
            // the stroke resulting from split() is outside, keep it
            S.Split(exitRect);
            // the stroke from this split() is inside, delete it
            Stroke temp = S.Split(enterRect);
            temp.Ink.DeleteStroke(temp);
            continue;
        }

        // check if stroke starts inside the rectangle and goes outside
        // if so, split and delete the segment inside the rectangle
        if (enterRect == -1 && exitRect > 0)
        {
            // the stroke resulting from split() is outside, keep it
            S.Split(exitRect);
            // delete the remaining segment of the stroke
            S.Ink.DeleteStroke(S);
            continue;
        }

        // check if stroke starts outside the rectangle and ends inside
        // if so, split and delete the segment inside the rectangle
        if (enterRect > 0 && exitRect == -1)
        {
            Stroke temp2 = S.Split(enterRect);
            temp2.Ink.DeleteStroke(temp2);
        }
    }
}

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

StrokeIntersection 구조체

StrokeIntersection 멤버

Microsoft.Ink 네임스페이스

StrokeIntersection.EndIndex