Condividi tramite


Metodo Strokes.Clip

Aggiornamento: novembre 2007

Rimuove le parti di ogni oggetto Stroke dell'insieme Strokes esterne al rettangolo specificato.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Sub Clip ( _
    r As Rectangle _
)
'Utilizzo
Dim instance As Strokes
Dim r As Rectangle

instance.Clip(r)
public void Clip(
    Rectangle r
)
public:
void Clip(
    Rectangle r
)
public void Clip(
    Rectangle r
)
public function Clip(
    r : Rectangle
)

Parametri

Note

Il parametro R viene specificato nelle coordinate dello spazio di input penna.

Questo metodo aggiorna l'oggetto Ink padre. Tutte le volte che l'input penna viene rimosso da un oggetto Ink, tutti gli oggetti Stroke o insiemi Strokes definiti per quell'oggetto Ink possono essere invalidati.

Dopo avere chiamato il metodo Clip, le proprietà di ogni oggetto Stroke possono cambiare. Ad esempio, quando un oggetto Stroke inizia all'interno dell'area del rettangolo di ritaglio, esce da tale rettangolo e quindi ritorna al suo interno; si ottengono due oggetti Stroke, di cui almeno uno dispone di una nuova proprietà Id. Nonostante questo comportamento, viene garantita l'unicità di tutte le proprietà Id all'interno di un oggetto Ink, anche se cambiano. Anche altre proprietà dell'oggetto Stroke possono essere sottoposte a modifiche simili.

Esempi

In questo esempio, un insieme Strokes di un oggetto InkOverlay viene ritagliato nella metà destra dell'insieme Strokes. Innanzitutto, il rettangolo di delimitazione dell'insieme Strokes viene ottenuto chiamando il metodo GetBoundingBox. Un nuovo rettangolo con la metà destra ritagliata viene quindi creato e passato al metodo Clip.

' 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
    ' Determine the bounding box for the Strokes collection.
    Dim bounds As Rectangle = allStrokes.GetBoundingBox()
    'Create rectangle for Clip method.
    Dim halfRectangle As Rectangle = _
            New Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height)
    ' Clip the Strokes collection.
    allStrokes.Clip(halfRectangle)
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)
{
    // Determine the bounding box for the Strokes collection.
    Rectangle bounds = allStrokes.GetBoundingBox();
    //Create rectangle for Clip method.
    Rectangle halfRectangle = 
        new Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height);
    // Clip the Strokes collection.
    allStrokes.Clip(halfRectangle);
}

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

Strokes Classe

Membri Strokes

Spazio dei nomi Microsoft.Ink

BoundingBoxMode

Stroke.Clip

GetBoundingBox