StrokeCollection.GetBounds Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Restituisce i limiti dei tratti nell'insieme.
public:
System::Windows::Rect GetBounds();
public System.Windows.Rect GetBounds();
member this.GetBounds : unit -> System.Windows.Rect
Public Function GetBounds () As Rect
Valori restituiti
Oggetto Rect contenente i limiti dei tratti nell'oggetto StrokeCollection.
Esempio
Nell'esempio seguente viene illustrato come ottenere i limiti dell'oggetto StrokeCollection e disegnarli sul controllo . In questo esempio si presuppone che sia presente un InkCanvas oggetto denominato inkCanvas1.
public void GetBounds()
{
Rect bounds = inkCanvas1.Strokes.GetBounds();
Rectangle boundsShape = new Rectangle();
boundsShape.Width = bounds.Width;
boundsShape.Height = bounds.Height;
boundsShape.Stroke = Brushes.Red;
InkCanvas.SetTop(boundsShape, bounds.Top);
InkCanvas.SetLeft(boundsShape, bounds.Left);
inkCanvas1.Children.Add(boundsShape);
}
Public Sub GetBounds()
Dim bounds As Rect = inkCanvas1.Strokes.GetBounds()
Dim boundsShape As Rectangle = New Rectangle()
boundsShape.Width = bounds.Width
boundsShape.Height = bounds.Height
boundsShape.Stroke = Brushes.Red
InkCanvas.SetTop(boundsShape, bounds.Top)
InkCanvas.SetLeft(boundsShape, bounds.Left)
inkCanvas1.Children.Add(boundsShape)
End Sub
Commenti
Il GetBounds metodo restituisce un oggetto Rect che assume l'aspetto dell'oggetto di cui è stato eseguito Strokeil rendering. Ad esempio, se Stroke è largo 10 pixel indipendenti (DIP), Rect include l'intera larghezza di Stroke.