Working with Layers

Start with the project you created in Implementing Hit Testing.

Take the following steps to show/hide layers from a vector drawing:

1.

Click the "Class View" tab of the project workspace.

2.

Click to open the MyVectorWindow branch.

3.

Double-click the MsgProcCallBack () member function.

4.

Declare the following variables local to the MsgProcCallBack() function.

L_INT  nIndex; 
LVectorLayer  Layer; 
VECTORLAYERDESC  LayerDesc; 
  

5.

Add the following code immediately before case 'b':

case '1': 
case '2': 
{ 
   // get layer from index 
   if( wParam == '1' ) 
      nIndex = 0; 
   else 
      nIndex = 1; 
    
   GetLayerByIndex (nIndex, &Layer ); 
   // flip the visible state of the layer 
   Layer.GetLayerDesc (&LayerDesc); 
   LayerDesc.bVisible =!LayerDesc.bVisible; 
   Layer.SetLayerDesc (&LayerDesc); 
   InvalidateRect( hWnd, NULL, FALSE ); 
} 
break; 

6.

Compile and run the demo.

7.

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.

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Vector C++ Class Library Help