Freigeben über


InkSpaceToPixel Method

InkSpaceToPixel Method

Converts a location in ink space coordinates to be a location in pixel space using a handle for the conversion.

Declaration

[C++]

HRESULT InkSpaceToPixel (
    [in] long hdcDisplay,
    [in,out] long* x,
    [in,out] long* y
);

[Microsoft® Visual Basic® 6.0]

Public Sub InkSpaceToPixel( _
    hdcDisplay As Long, _
    x As Long, _
    y As Long _
)

Parameters

hdcDisplay

[in] The handle of the device context.

x

[in, out] The X-coordinate of the point to convert into a pixel location.

y

[in, out] The Y-coordinate of the point to convert into a pixel location.

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.
E_INVALIDARG Invalid display handle.
E_FAIL Coordinates overflowed during operation.

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 gets the bounds of all of the ink in the InkCollector object in pixel space, returning them in the reference parameters as left, top, right, and bottom.

Private Sub getBoundsFromInk( _
ByRef left As Long, _
ByRef top As Long, _
ByRef right As Long, _
ByRef bottom As Long, _
ByRef theInkCollector As InkCollector, _
ByVal theHDC As Long)
    Dim theBoundingRectangle As New InkRectangle
    Set theBoundingRectangle = theInkCollector.Ink.GetBoundingBox(IBBM_Default)
    left = theBoundingRectangle.left
    top = theBoundingRectangle.top
    right = theBoundingRectangle.right
    bottom = theBoundingRectangle.bottom

    ' Find the edges of the bounding box in pixel space
    theInkCollector.Renderer.InkSpaceToPixel theHDC, left, top
    theInkCollector.Renderer.InkSpaceToPixel theHDC, right, bottom
End Sub

Applies To