Partager via


Strokes.ScaleToRectangle Method

Strokes.ScaleToRectangle Method

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

Definition

Visual Basic .NET Public Sub ScaleToRectangle( _
ByVal scaleRectangle As Rectangle _
)
C# public void ScaleToRectangle(
Rectangle scaleRectangle
);
Managed C++ public: void ScaleToRectangle(
Rectangle *scaleRectangle
);

Parameters

scaleRectangle System.Drawing.Rectangle. The System.Drawing.Rectangle Leave Site structure, in ink space coordinates, to which the Strokes collection is scaled.

Exceptions

ObjectDisposedException Leave Site: The Strokes collection is disposed.

Remarks

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

Examples

[C#]

This C# example scales the ink to fit in the left half of the original bounding box. The strokes are taken from an InkOverlay object, theInkOverlay, and a Rectangle Leave Site structure, halfRectangle, is created for the left half of the bounding box. The ScaleToRectangle method is then called, passing in halfRectangle as the scaleRectangle parameter.

Rectangle inkBounds = inkOverlay.Ink.Strokes.GetBoundingBox();
Rectangle halfRectangle = new Rectangle(inkBounds.Left,
     inkBounds.Top, inkBounds.Width / 2, inkBounds.Height);
inkOverlay.Ink.Strokes.ScaleToRectangle(halfRectangle);
                

[VB.NET]

This Microsoft® Visual Basic® .NET example scales the ink to fit in the left half of the original bounding box. The strokes are taken from an InkOverlay object, theInkOverlay, and a Rectangle Leave Site structure, halfRectangle, is created for the left half of the bounding box. The ScaleToRectangle method is then called, passing in halfRectangle as the scaleRectangle parameter.

Dim inkBounds As Rectangle = inkOverlay.Ink.Strokes.GetBoundingBox()
Dim halfRectangle As New Rectangle(inkBounds.Left, _
     inkBounds.Top, inkBounds.Width / 2, inkBounds.Height)
inkOverlay.Ink.Strokes.ScaleToRectangle(halfRectangle)
                

See Also