次の方法で共有


InkSpaceToPixelFromPoints Method (Automation Only)

InkSpaceToPixelFromPoints Method (Automation Only)

Converts an array of points in ink space coordinates to be an array of points in pixel space.

Declaration

[C++]

void InkSpaceToPixelFromPoints (
    [in] long hdcDisplay,
    [in,out] VARIANT *points
);

[Microsoft® Visual Basic® 6.0]

Public Sub InkSpaceToPixelFromPoints( _
    hdcDisplay As Long, _
    points As Variant _
)

Parameters

hdcDisplay

[in] The handle of the device context on which to draw.

points

[in, out] The array of points in ink space coordinates to convert into pixel locations. This should be an array of 32-bit integer (in Visual Basic 6.0, Long) values, passed within a Variant.

For more information about the VARIANT structure, see Using the Automation Library.

Return Value

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

Remarks

InkSpaceToPixelFromPoints applies the object transform, applies the view transform of the InkRenderer object, and then converts from inkspace to pixel units (1 ink unit = .01mm).

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates an array of points in ink space that describe a diamond shape ten millimeters wide and tall, and converts the array to pixel space, then creates a stroke with the array, colors it green, and adds it to the ink to display.

Option Explicit
Dim theInkCollector As InkCollector

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

    Dim ptStrokePoints(9) As Long
    ptStrokePoints(0) = 1000
    ptStrokePoints(1) = 500
    ptStrokePoints(2) = 500
    ptStrokePoints(3) = 1000
    ptStrokePoints(4) = 1000
    ptStrokePoints(5) = 1500
    ptStrokePoints(6) = 1500
    ptStrokePoints(7) = 1000
    ptStrokePoints(8) = 1000
    ptStrokePoints(9) = 500
    Dim thePointArray As Variant
    thePointArray = ptStrokePoints

    'Convert this array of ink space points to pixels.
    theInkCollector.Renderer.InkSpaceToPixelFromPoints Form1.hDC, thePointArray

    'The description value is an unused placeholder.
    Dim theDescription As Variant
    Dim theStroke As IInkStrokeDisp
    Set theStroke = theInkCollector.Ink.CreateStroke(ptStrokePoints, theDescription)
    theStroke.DrawingAttributes.Color = RGB(0, 255, 0)
    theInkCollector.Ink.Strokes.Add theStroke
End Sub

Applies To