Share via


Strokes.ScaleToRectangle Method

Scales the Strokes collection to fit in the specified Rectangle structure.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Sub ScaleToRectangle ( _
    scaleRectangle As Rectangle _
)
'Usage
Dim instance As Strokes 
Dim scaleRectangle As Rectangle

instance.ScaleToRectangle(scaleRectangle)
public void ScaleToRectangle(
    Rectangle scaleRectangle
)
public:
void ScaleToRectangle(
    Rectangle scaleRectangle
)
public function ScaleToRectangle(
    scaleRectangle : Rectangle
)

Parameters

Remarks

The Strokes collection is scaled and translated to match the Stroke collection's bounding box to the rectangle.

Examples

In this example, a Strokes collection of an InkOverlay,object is scaled to fit into the left half of the original bounding box. First, the bounding rectangle of the Strokes collection is obtained by calling the GetBoundingBox method using the CurveFit value of the BoundingBoxMode enumeration to determine the bounds of the bounding box. A new rectangle with half the width of the original is then created and passed to the ScaleToRectangle method.

' 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
    Dim bounds As Rectangle = allStrokes.GetBoundingBox(BoundingBoxMode.CurveFit)
    Dim halfRectangle As Rectangle = _
            New Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height)
    allStrokes.ScaleToRectangle(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)
{
    Rectangle bounds = allStrokes.GetBoundingBox(BoundingBoxMode.CurveFit);
    Rectangle halfRectangle = 
        new Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height);
    allStrokes.ScaleToRectangle(halfRectangle);
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Strokes Class

Strokes Members

Microsoft.Ink Namespace

Stroke.ScaleToRectangle

Strokes.GetBoundingBox

Strokes.Scale

Strokes.Transform