#include "ltwrappr.h"
virtual L_INT LVectorBase::ConvertToEMF(hdc, phEnhMetaFile, uDPI, pRect = NULL)
HDC hdc; |
handle to a device context |
HENHMETAFILE *phEnhMetaFile; |
pointer to a variable to be updated |
L_UINT uDPI; |
Dots per inch |
const RECT *pRect; |
/ * pointer to a structure */ |
Converts a LEAD Technologies vector handle into an enhanced Windows metafile (EMF). When this function is completed, there are two copies of the drawing in memory: the EMF and the original LEAD vector. Freeing one will not affect the other.
Parameter |
Description |
hdc |
Handle to the device context responsible for the conversion. |
phEnhMetaFile |
Pointer to a metafile handle to be updated with the converted vector. |
uDPI |
Dots per inch which should be used to convert the drawing. |
pRect |
Pointer to a RECT structure that contains the dimensions, in .01 millimeter units, of the drawing to be stored in the enhanced metafile. If this parameter is NULL, the vector toolkit computes the dimensions of the smallest rectangle that bounds the vector drawing. This parameter should be provided whenever possible. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
This function allocates an EMF handle and copies the LEAD vector to the EMF.
If this function is called with pRect containing these values:
pRect->left = 0;
pRect->top = 0;
pRect->right = 1000;
pRect->bottom = 1000;
the vector drawing will be converted to an EMF file with logical size 0 to 10 mm in width and height.
This is very helpful when printing. For example, determine the printers printable area in millimeters. Divide that value by 100 and pass the resulting value as the right and bottom members of the RECT structure. The resulting EMF will have the same logical size as the printer, resulting in high image quality when printing the EMF file.
Required DLLs and Libraries
LVKRN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Functions: |
LVectorBase::ConvertFromEMF, LVectorBase::ConvertToWMF, LVectorBase::ConvertFromWMF |
Topics: |
|
|
L_INT LVectorBase__ConvertToEMFExample( HWND hWnd, L_TCHAR *pszFile, HENHMETAFILE &hEMF)
{
L_INT nRet;
LVectorBase Vector;
HDC hDC;
//Load the drawing
nRet = Vector.Load(pszFile);
if(nRet != SUCCESS)
return nRet;
//Convert to EMF
hDC = GetDC( hWnd );
nRet = Vector.ConvertToEMF(hDC, &hEMF, 96);
if(nRet != SUCCESS)
return nRet;
ReleaseDC( hWnd, hDC );
return SUCCESS;
}