共用方式為


Transform Method

Transform Method

Applies a linear transformation to an IInkStrokeDisp object or an InkStrokes collection, which can represent scaling, rotation, translation, and combinations of transformations.

Declaration

[C++]

        HRESULT Transform (
    [in] IInkTransform* mInkTransform,
    [in, optional, defaultvalue(0)] VARIANT_BOOL ApplyOnPenWidth
);
      

[Microsoft® Visual Basic® 6.0]

        Public Sub Transform( _
    mInkTransform As InkTransform, _
    [ApplyOnPenWidth As Boolean = False] _
)
      

Parameters

mInkTransform

[in] The transform to use on the stroke or strokes. (This is an InkTransform object, which correlates to the XFORM structure Leave Site.) The transformation applies to both the points and pen width (if ApplyOnPenWidth is TRUE).

ApplyOnPenWidth

[in, optional] The Boolean value that determines whether to apply the transform to the width of the ink in the InkDrawingAttributes of the strokes. The default is FALSE.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_INVALIDARG Invalid argument.
E_UNEXPECTED Unexpected parameter or property type.
E_INK_EXCEPTION An exception occurred inside the method.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example calls Transform on the strokes in the ink in the InkCollector in the event handler for a command button to rotate the strokes 180 degrees around the point (4000, 4000) in ink space.

        Option Explicit
Dim theInkCollector As InkCollector

Private Sub Command1_Click()
    Dim theInkTransform As New InkTransform
    'Rotate the ink through 180 degrees around (4000, 4000)
    theInkTransform.SetTransform -1!, 0!, 0!, -1!, 8000!, 8000!
    theInkCollector.Ink.Strokes.Transform theInkTransform, False
    Form1.Refresh
End Sub

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

Applies To