Available in LEADTOOLS Medical Imaging toolkits. |
L_DispContainerBeginUpdate
#include "l_bitmap.h"
L_LTIVW_API L_INT EXT_FUNCTION L_DispContainerBeginUpdate(hCon, uFlags)
HDISPCONTAINER hCon; |
/* handle to the container */ |
L_UINT uFlags; |
/* reserved for future use */ |
Stops the viewer from being refreshed if any change is applied, it's generally useful to increase the control speed efficiency. To resume refreshing, use the L_DispContainerEndUpdate function.
Parameter |
Description |
hCon |
Handle to the container. |
uFlags |
Reserved for future use. Pass 0. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Stops the viewer from refreshing after each change is applied, until refreshing is resumed by calling L_DispContainerEndUpdate. At that point the viewer will repaint to show all of the changes that have been made. This is useful for better visual results and for speed efficiency.
Required DLLs and Libraries
LTIVW For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 2000 / XP/Vista.
See Also
Functions: |
L_DispContainerCreate, L_DispContainerDestroy, L_DispContainerRepaintCell, L_DispContainerUpdateCellView, L_DispContainerEndUpdate |
Topics: |
Example
This example creates a medical viewer control and two cells. then it will ask whether the apply some effects on the cell with or without using BeginUpdate/EndUpdate. Run this sample twice and see the difference
#if defined (LEADTOOLS_V16_OR_LATER) L_INT DispContainerBeginUpdateExample(HWND hWndParent) { DISPCONTAINERPROPERTIES DispContainerProp; DISPCELLPROPERTIES DispCellProp; RECT rcRect; L_INT nRet; L_INT nCellIndex; HDISPCONTAINER hCon; HBITMAPLIST hBitmapList; L_UINT uScaleMode; // Create a container at a size of the its parent. GetClientRect(hWndParent, &rcRect); hCon = L_DispContainerCreate (hWndParent, &rcRect, 0); // Change the number of rows and cols to show all the inserted cells. DispContainerProp.uStructSize = sizeof(DISPCONTAINERPROPERTIES); DispContainerProp.uNumCols = 2; DispContainerProp.uNumRows = 1; DispContainerProp.uMask = DCPF_NUMROWS | DCPF_NUMCOLS; nRet = L_DispContainerSetProperties (hCon, &DispContainerProp, 0); if(nRet != SUCCESS) return nRet; // load a bitmap list. nRet = L_LoadBitmapList (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\xa.dcm"), &hBitmapList, 0, ORDER_BGRORGRAY, NULL, NULL); // if the image is corrupted, not found, or not supported, the program will destroy the container and terminate if (nRet != SUCCESS) { MessageBox(hWndParent,TEXT("Could not load Image1.dic"),TEXT("Error: Aborting"), MB_OK); L_DispContainerDestroy (hCon, FALSE, 0); return nRet; } // Insert a new cell at the end of the container cell queue. nCellIndex = L_DispContainerInsertCell(hCon, -1, 0); // Attach the loaded bitmaplist to the newly inserted cell. nRet = L_DispContainerSetCellBitmapList(hCon, nCellIndex, hBitmapList, TRUE, 0); if(nRet != SUCCESS) return nRet; // Add some tags to the cell L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_TOPLEFT , 0, TEXT("Image1 Text 1"), 0); nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 1, DISPWIN_ALIGN_TOPLEFT , 0, TEXT("Image1 Text 2"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 2, DISPWIN_ALIGN_TOPLEFT , 0, TEXT("Image1 Text 3"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 3, DISPWIN_ALIGN_TOPLEFT , 0, TEXT("Image1 Text 4"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 1, DISPWIN_ALIGN_LEFTCENTER , 0, TEXT("L"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_BOTTOMLEFT , 0, TEXT("Image1 Text 5"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_TOPCENTER , 0, TEXT("Top"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Bottom"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_TOPRIGHT , 0, TEXT("Image1 Text 6"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 8, DISPWIN_ALIGN_TOPLEFT , DISPWIN_TYPE_FRAME, NULL, 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_BOTTOMRIGHT , DISPWIN_TYPE_OWNERDRAW, NULL, 0); if(nRet != SUCCESS) return nRet; // if the image is corrupted, not found, or not supported, the program will destroy the container and terminate if (nRet != SUCCESS) { MessageBox(hWndParent,TEXT("Could not load Image3.dic"), TEXT("Error: Aborting"), MB_OK); L_DispContainerDestroy (hCon, FALSE, 0); return nRet; } // load another bitmap list nRet = L_LoadBitmapList (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\image2.dic"), &hBitmapList, 0, ORDER_BGRORGRAY, NULL, NULL); if(nRet != SUCCESS) return nRet; // insert a new cell at the end of the container queue. nCellIndex = L_DispContainerInsertCell (hCon, -1, 0); // Attach the loaded bitmap list the newly inserted cell. nRet = L_DispContainerSetCellBitmapList (hCon, nCellIndex, hBitmapList, TRUE, 0); if(nRet != SUCCESS) return nRet; // Add some tags to the cell nRet = L_DispContainerSetCellTag (hCon, nCellIndex, 0, DISPWIN_ALIGN_TOPLEFT , 0,TEXT("Image3 Text 1"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 2, DISPWIN_ALIGN_TOPLEFT , 0, TEXT("Image3 Text 2"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 4, DISPWIN_ALIGN_TOPLEFT , 0, TEXT("Image3 Text 3"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 6, DISPWIN_ALIGN_TOPLEFT , 0, TEXT("Image3 Text 4"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 1, DISPWIN_ALIGN_LEFTCENTER , 0, TEXT("Image3 Text 5"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_BOTTOMLEFT , 0, TEXT("Image3 Text 6"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_TOPCENTER , 0, TEXT("Image3 Text 7"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Image3 Text 8"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_TOPRIGHT , 0, TEXT("Image3 Text 9"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 7, DISPWIN_ALIGN_TOPLEFT , DISPWIN_TYPE_SCALE, NULL, 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetCellTag(hCon, nCellIndex, 1, DISPWIN_ALIGN_BOTTOMLEFT , DISPWIN_TYPE_WLCENTERWIDTH, NULL, 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetSubCellTag(hCon, 0, 8, 0, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 1"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetSubCellTag(hCon, 1, 0, 8, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 2"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetSubCellTag(hCon, 1, 1, 9, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 3"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetSubCellTag(hCon, 1, 2, 10, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 4"), 0); if(nRet != SUCCESS) return nRet; nRet = L_DispContainerSetSubCellTag(hCon, 1, 3, 11, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 5"), 0); if(nRet != SUCCESS) return nRet; // Change the number of sub-rows and sub-cols. DispCellProp.uStructSize = sizeof(DISPCELLPROPERTIES); DispCellProp.uMask = DCCELLPF_ROWS | DCCELLPF_COLS | DCCELLPF_IMAGE_FIT; DispCellProp.uNumCols = 3; DispCellProp.uNumRows = 3; DispCellProp.bIsFit = FALSE; nRet = L_DispContainerSetCellProperties(hCon, 0, &DispCellProp, 0); if(nRet != SUCCESS) return nRet; ShowWindow(hWndParent, SW_MAXIMIZE); UpdateWindow(hWndParent); L_INT nMessageRet = MessageBox(hWndParent, TEXT("This demo will do some effects on the Medical viewer, Do you want to use the begin and update update?"), TEXT("Begin Update And End Update Demo"), MB_YESNO); if (nMessageRet == IDYES) L_DispContainerBeginUpdate(hCon, 0); DISPCELLTAGINFO TagInfo; L_DOUBLE dScale; L_TCHAR szText[100] = TEXT("Edited Text 1"); TagInfo.uStructSize = sizeof(DISPCELLTAGINFO); TagInfo.uMask = DCTF_TEXT; TagInfo.szText = szText; L_DispContainerEditCellTag(hCon, 0, 0, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); nRet = L_DispContainerDeleteCellTag(hCon, 0, 8, DISPWIN_ALIGN_TOPLEFT, 0); if(nRet != SUCCESS) return nRet; // Shift the second row, one row down nRet = L_DispContainerGetCellTag(hCon, 0, 2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); if(nRet != SUCCESS) return nRet; TagInfo.uPosition += 1; nRet = L_DispContainerEditCellTag(hCon, 0, 2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); if(nRet != SUCCESS) return nRet; // Shift the second row, one row down nRet = L_DispContainerGetSubCellTag(hCon, 1, 0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); if(nRet != SUCCESS) return nRet; TagInfo.szText = TEXT("Edited sub-cell Tag1"); L_DispContainerEditSubCellTag(hCon, 1, 0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); L_DispContainerDeleteSubCellTag(hCon, 0, 0, 8, DISPWIN_ALIGN_TOPLEFT, 0); L_DispContainerAddAction(hCon, CONTAINER_ACTION_WINDOWLEVEL, 0); L_DispContainerSetAction(hCon, CONTAINER_ACTION_WINDOWLEVEL, CONTAINER_MOUSE_BUTTON_LEFT, 0); L_DispContainerAddAction(hCon, CONTAINER_ACTION_ALPHA, 0); L_DispContainerAddAction(hCon, CONTAINER_ACTION_OFFSET , 0); L_DispContainerAddAction(hCon, CONTAINER_ACTION_MAG, 0); L_DispContainerAddAction(hCon, CONTAINER_ACTION_SCALE , 0); L_DispContainerAddAction(hCon, CONTAINER_ACTION_STACK , 0); DISPWLEVELACTIONPROPS DispContianerWindowLevel; DispContianerWindowLevel.DispContainerActionProps.uStructSize = sizeof(DISPWLEVELACTIONPROPS); L_DispContainerGetActionProperties(hCon, CONTAINER_ACTION_WINDOWLEVEL, 0, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CONTAINERLEVEL); L_DispContainerGetActionProperties(hCon, CONTAINER_ACTION_WINDOWLEVEL, 0, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); DispContianerWindowLevel.nWidth = 20; DispContianerWindowLevel.nCenter = 50; L_DispContainerSetActionProperties(hCon, CONTAINER_ACTION_WINDOWLEVEL, 0, -1, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); L_DispContainerSetActionProperties(hCon, CONTAINER_ACTION_WINDOWLEVEL, 1, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); L_DispContainerGetCellScale(hCon, 0, 0, &dScale, 0); dScale *= 2; L_DispContainerSetCellScale(hCon, 0, -1, dScale, 0); L_DispContainerSetCellScale(hCon, 1, 0, dScale, 0); L_DispContainerGetCellScaleMode(hCon, 0, 0, &uScaleMode, 0); if (uScaleMode != CONTAINER_SCALEMODE_FIT) uScaleMode = CONTAINER_SCALEMODE_FIT; else uScaleMode = CONTAINER_SCALEMODE_NORMAL; L_DispContainerSetCellScaleMode(hCon, 1, -1, uScaleMode, 0); L_DispContainerSetCellScaleMode(hCon, 0, -1, uScaleMode, 0); if (nMessageRet == IDYES) L_DispContainerEndUpdate(hCon, 0); return SUCCESS; } #endif