#include "ltwrappr.h"
virtual L_INT LAnnToolBar::FreeToolBarButtons(pButtons, uButtons)
pANNBUTTON pButtons; |
array of buttons to include in the toolbar |
L_UINT uButtons; |
number of buttons in the toolbar |
Frees the memory allocated by LAnnToolBar::GetToolBarButtons for the pButtons array.
Parameter |
Description |
pButtons |
An array of ANNBUTTON structures that contain information about the buttons in the annotation toolbar. |
uButtons |
Number of buttons in the toolbar. (Number of entries in the pButtons array.) |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileNameL_INT LAnnToolBar_FreeToolBarButtonsExample(LAnnToolBar annToolBar){L_UINT uButtons;pANNBUTTON pButtons;L_INT nRet;HGLOBAL hGlobal;LBitmap myBitmap;//Assume declaration: LAnnToolBar m_annToolBarmyBitmap.Load(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\FadeMask.bmp")));myBitmap.Size(TOOLBARIMAGECX, TOOLBARIMAGECY);// get the number of buttons in the toolbarnRet = annToolBar.GetToolBarButtons(NULL,sizeof(ANNBUTTON), &uButtons);if (nRet == SUCCESS){// allocate an array big enough to hold the number of existing buttons + 1hGlobal = ::GlobalAlloc(GMEM_MOVEABLE, (uButtons+1)*sizeof(ANNBUTTON));pButtons = (pANNBUTTON)::GlobalLock(hGlobal);if (pButtons){// get the existing buttonsnRet = annToolBar.GetToolBarButtons(pButtons,sizeof(ANNBUTTON), &uButtons);if (nRet == SUCCESS){// add a new user defined tool buttonpButtons[uButtons].uFlags = 0;pButtons[uButtons].uTool = ANNTOOL_USER;pButtons[uButtons].uBitmapStructSize=sizeof(BITMAPHANDLE);pButtons[uButtons].pBitmapUp = myBitmap.GetHandle();pButtons[uButtons].pBitmapDown = pButtons[uButtons].pBitmapUp;pButtons[uButtons].nToolTipTextID = -1;pButtons[uButtons].pToolTipText = TEXT("Tool Tip");annToolBar.SetToolBarButtons(pButtons, uButtons+1);// free uButtonsannToolBar.FreeToolBarButtons(pButtons, uButtons);::GlobalUnlock(pButtons);::GlobalFree(hGlobal);//Change the number of rows and columnsANNTOOLBARINFO annToolBarInfo;annToolBar.GetToolBarInfo(&annToolBarInfo, sizeof(annToolBarInfo));if(annToolBarInfo.uRows > 1){annToolBar.SetToolBarColumns(annToolBarInfo.uColumns + 1);// or do the line below//m_annToolBar.SetToolBarRows(annToolBarInfo.uRows -1);}}elseAfxMessageBox(TEXT("Error getting toolbar buttons."));}elseAfxMessageBox(TEXT("Not enough memory to allocate pButtons."));}elseAfxMessageBox(TEXT("Error getting uButtons."));return SUCCESS;}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
