Take the following steps to show/hide layers from a vector drawing:
Start with the project you created in Implementing Hit Testing.
Add these local variables under the HDC hDC; statement in the WndProc function:
Add the following lines in WM_CREATE handler right after L_VecInit ( &Vector ); statement:
L_VecLoadFile (MAKE_IMAGE_PATH(TEXT("random.dxf")), &Vector, NULL, NULL );
Add the following lines before the case 'x' statement of the WM_CHAR message:
// get layer from index
if( wParam == '1' )
nIndex = 0;
nIndex = 1;
L_VecGetLayerByIndex ( &Vector, nIndex, &Layer );
L_VecGetLayer ( &Vector, &Layer, &LayerDesc );
// flip the visible state of the layer
LayerDesc.bVisible = !LayerDesc.bVisible;
L_VecSetLayer ( &Vector, &Layer, &LayerDesc );
L_VecFreeLayer ( &LayerDesc );
InvalidateRect( hWnd, NULL, FALSE );
Compile and run the demo.
The sample image (random.dxf) shipped with LEADTOOLS has 2 layers. You should be able to hide/show those layers by pressing 1 and 2 on your keyboard.