StrokeCollection.GetBounds Yöntem

Tanım

Koleksiyondaki vuruşların sınırlarını döndürür.

public:
 System::Windows::Rect GetBounds();
public System.Windows.Rect GetBounds ();
member this.GetBounds : unit -> System.Windows.Rect
Public Function GetBounds () As Rect

Döndürülenler

Rect

Rect içindeki vuruşların StrokeCollectionsınırlarını içeren bir.

Örnekler

Aşağıdaki örnekte, 'nin StrokeCollection sınırlarını alma ve bunları denetime çizme işlemleri gösterilmektedir. Bu örnekte adlı inkCanvas1bir InkCanvas olduğu varsayılır.

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

Açıklamalar

yöntemi, GetBounds işlenen Strokegörünümünü alan bir Rect döndürür. Örneğin, 10 monitör bağımsız piksel (DIP) genişliğindeyse Stroke , Rect genişliğin Stroketamamını içerir.

Şunlara uygulanır