共用方式為


AtlPixelToHiMetric

Converts an object's size in pixels on the screen device to a size in HIMETRIC units (each unit is 0.01 millimeter).

extern void AtlPixelToHiMetric(
   const SIZEL* lpSizeInPix,
   LPSIZEL lpSizeInHiMetric 
);

Parameters

  • lpSizeInPix
    [in] Pointer to the object's size in pixels.

  • lpSizeInHiMetric
    [out] Pointer to where the object's size in HIMETRIC units is to be returned.

Example

// Initialize our control's default size to 100 by 25 pixels
CMyControl::CMyControl()
{
    // width = 100 pixels, height = 25 pixels
    SIZE sz = { 100, 25 };
    // convert pixels to himetric
    AtlPixelToHiMetric(&sz, &m_sizeExtent);
    // store natural extent
    m_sizeNatural = m_sizeExtent;
}

Requirements

Header: atlwin.h

See Also

Concepts

Pixel/HIMETRIC Conversion Global Functions

AtlHiMetricToPixel