Proprietà StrokeIntersection.EndIndex
Aggiornamento: novembre 2007
Ottiene o imposta il punto finale della struttura StrokeIntersection.
Spazio dei nomi: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Sintassi
'Dichiarazione
Public Property EndIndex As Single
'Utilizzo
Dim instance As StrokeIntersection
Dim value As Single
value = instance.EndIndex
instance.EndIndex = value
public float EndIndex { get; set; }
public:
property float EndIndex {
float get ();
void set (float value);
}
/** @property */
public float get_EndIndex()
/** @property */
public void set_EndIndex(float value)
public function get EndIndex () : float
public function set EndIndex (value : float)
Valore proprietà
Tipo: System.Single
Indice a virgola mobile in corrispondenza del quale l'intersezione termina.
Note
Se il tratto termina all'interno dell'area di intersezione, questo valore è -1.
Un indice a virgola mobile è un valore float che rappresenta una posizione tra due punti nel tratto. Ad esempio, se 0,0 è il primo punto nel tratto e 1,0 è il secondo punto nel tratto, 0,5 si trova in posizione intermedia tra il primo e il secondo punto. Allo stesso modo, un valore di indice a virgola mobile di 37,25 rappresenta una posizione che si trova al 25 percento sulla riga tra i punti 37 e 38 del tratto.
Esempi
In questo esempio vengono eliminati tutti i segmenti di un oggetto Stroke passato che si trovano nella struttura Rectangle specificata. A tale scopo vengono esaminate le strutture StrokeIntersection per determinare in quali punti suddividere l'oggetto Stroke passato e quali segmenti eliminare.
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);
}
}
}
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
StrokeIntersection.EndIndex