Sets the current viewport mode used when loading 3D file formats.
static L_INT LFileSettings::SetViewMode2D(nViewMode)
New viewport mode. Possible values are:
|L2D_USE_BEST||Fit the drawing into current viewport width and height. Final image size is less than or equal to viewport size.|
|L2D_USE_WIDTH||Use the current viewport width. Calculate new height, preserving the aspect ratio. Final image size has the same width as the current viewport width, with the height less than or equal to the current viewport height.|
|L2D_USE_HEIGHT||Use the current viewport height. Calculate the new width, preserving the aspect ratio. Final image size has the same height as the current viewport height, with the width less than or equal to the current viewport width.|
|L2D_USE_WIDTH_HEIGHT||Use both the width and the height (stretch image if necessary). Final image size has the same width and height as the current viewport size.|
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
A 3D file format usually does not have a physical size. The user can specify a viewport (physical size up to which the drawing can be rendered) with LFileSettings::SetViewport2D . How the drawing is to be rendered inside this viewport depends on the current viewport mode set with LFileSettings::SetViewMode2D. Default viewport size is 640x480 pixels.
When working with DXF files, you can use the Vector features, available in selected products, or you can use the Main C++ Class Library. If you use the Main C++ Class Library for loading, using the standard loading functions, you can modify the view port and view mode using the following functions:
This function may be used with the following Vector file formats: DXF, DWG, WMF, EMF, PCT, CGM, DRW, PLT, TIF (with a DXF saved internally) and Intergraph Vector. For more information on these file formats and their availability, refer to LEADTOOLS Vector Formats.
L_INT LFileSettings__SetViewMode2DExample( HWND hWnd )
/* Set viewport mode to L2D_USE_WIDTH_AND_HEIGHT */
nRet = LFileSettings::SetViewMode2D( L2D_USE_WIDTH_HEIGHT );
if(nRet != SUCCESS)
/* Set viewport size to 400*400 pixels */
nRet = LFileSettings::SetViewport2D( 400, 400 );
if(nRet != SUCCESS)
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries