Vector Tools

Start with the project you created in Vector Load and Save.

Take the following steps to add panning, selecting, and rotating capabilities:

  1. In the project workspace, click on the Resource View tab and then click to open the "Tutorial resouces" branch.

  2. Click to open the "Menu" branch and double click IDR_TutorialTYPE.

  3. Add a menu item called "Tools" between the Edit and View items.

  4. Create this Menu structure under the Tools Menu item:

    &None with ID = ID_TOOLS_NONE 
    &Pan with ID = ID_TOOLS_PAN 
    &Select with ID = ID_TOOLS_SELECT 
    &Rotate with  ID = ID_TOOLS_ROTATE 

  5. Select View->ClassView.

  6. Right click on CTutorialDoc and select properties.

  7. In the properties window select Events shortcut.

  8. Select ID_TOOLS_NONE then COMMAND then add OnToolsNone

  9. Repeat steps 5 6, and select ID_TOOLS_NONE then UPDATE_COMMAND_UI then add OnUpdateToolsNone

  10. Repeat steps 5 through 9 for ID_TOOLS_PAN, ID_TOOLS_ROTATE, ID_TOOLS_SELECT.

  11. Add the following code for the eight newly created functions:

    void CTutorialDoc::OnToolsNone() 
    { 
       m_pVectorWindow->SetToolType (TOOL_VECTOR_USERMODE); 
    } 
    void CTutorialDoc::OnUpdateToolsNone(CCmdUI* pCmdUI) 
    { 
       pCmdUI->SetCheck (m_pVectorWindow->GetToolType () == TOOL_VECTOR_USERMODE); 
    } 
    void CTutorialDoc::OnToolsPan() 
    { 
       m_pVectorWindow->SetToolType (TOOL_VECTOR_PANIMAGE); 
    } 
    void CTutorialDoc::OnUpdateToolsPan(CCmdUI* pCmdUI) 
    { 
       pCmdUI->SetCheck(m_pVectorWindow->GetToolType () == TOOL_VECTOR_PANIMAGE); 
    } 
    void CTutorialDoc::OnToolsSelect() 
    { 
       m_pVectorWindow->SetToolType (TOOL_VECTOR_SELECT); 
    } 
    void CTutorialDoc::OnUpdateToolsSelect(CCmdUI* pCmdUI) 
    { 
       pCmdUI->SetCheck(m_pVectorWindow->GetToolType () == TOOL_VECTOR_SELECT); 
    } 
    void CTutorialDoc::OnToolsRotate() 
    { 
       m_pVectorWindow->SetToolType (TOOL_VECTOR_ROTATE); 
    } 
    void CTutorialDoc::OnUpdateToolsRotate(CCmdUI* pCmdUI) 
    { 
       pCmdUI->SetCheck(m_pVectorWindow->GetToolType () == TOOL_VECTOR_ROTATE); 
    } 

  12. Compile and run the program. Load an image. Hit the "+" key on the numeric keypad several times to zoom on the image. Select the Pan tool. A hand appears. Click anywhere on the image and drag. Now choose the Select tool. Click and drag on the image to select objects. Left-double click to select all objects. Right double-click to unselect all objects. Choose the Rotate tool. Left click and drag to rotate about the x and y axes. Right click and drag to rotate along the Z-axis.

Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.