Freigeben über


ScaleToRectangle Method

ScaleToRectangle Method

Scales the IInkStrokeDisp object or InkStrokes collection to fit in the specified InkRectangle object.

Declaration

[C++]

HRESULT ScaleToRectangle (
    [in] IInkRectangle* rectangle
);

[Microsoft® Visual Basic® 6.0]

Public Sub ScaleToRectangle( _
    rectangle As InkRectangle _
)

Parameters

rectangle

[in] The InkRectangle in ink space to which the stroke or collection of strokes is scaled. The strokes are scaled and translated to match the strokes' bounding box to the rectangle.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_INK_EXCEPTION An exception occurred inside the method.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example demonstrates a simple call to ScaleToRectangle on the IInkStrokeDisp, Stroke with InkRectangle, theRectangle as the parameter. This causes the stroke to be scaled and translated so its bounding box matches theRectangle. In this simple example, every stroke is translated and scaled to fit a square near the top left corner of the form as soon as it is finished.

Option Explicit
Dim WithEvents theInkCollector As InkCollector

Private Sub Form_Load()
    Set theInkCollector = New InkCollector
    theInkCollector.hWnd = Me.hWnd
    theInkCollector.Enabled = True
End Sub

Private Sub theInkCollector_Stroke( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Stroke As MSINKAUTLib.IInkStrokeDisp, _
Cancel As Boolean)
    Dim theInkRectangle As New InkRectangle
    theInkRectangle.SetRectangle 400, 1000, 2400, 3000
    Stroke.ScaleToRectangle theInkRectangle
    Form1.Refresh
End Sub

Applies To