L_DispContainerBeginUpdate

#include "l_bitmap.h"

L_LTIVW_API L_INT EXT_FUNCTION L_DispContainerBeginUpdate(hCellWnd, uFlags)

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.

Parameters

L_HWND hCellWnd

A handle to the window that represents the Medical Viewer Cell.

L_UINT uFlags

Reserved for future use. Pass 0.

Returns

Value Meaning
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

Platforms

The toolkit comes in Win32 and x64 editions that can support development of software applications for any of the following environments:

Windows 10

Windows 8

Windows 7

Windows Vista

Windows XP

Windows 2000

See Also

Functions

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

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 (MAKE_IMAGE_PATH(TEXT("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, 0); 
      return nRet; 
   } 
 
   HWND hConWnd = L_DispContainerGetWindowHandle(hCon, 0); 
   HWND hCellWnd = L_DispContainerCreateCell(hConWnd, 0); 
 
   // Insert a new cell at the end of the container cell queue. 
   nCellIndex = L_DispContainerInsertCell(hCon, hCellWnd,  -1, 0); 
 
   // Attach the loaded bitmaplist to the newly inserted cell. 
   nRet = L_DispContainerSetCellBitmapList(hCellWnd, 
                                           hBitmapList, 
                                           TRUE, 
                                           0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Add some tags to the cell 
   L_DispContainerSetCellTag(hCellWnd, 0, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 1"), 0); 
   nRet = L_DispContainerSetCellTag(hCellWnd, 1, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 2, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 3, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 1, DISPWIN_ALIGN_LEFTCENTER  , 0, TEXT("L"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 0, DISPWIN_ALIGN_BOTTOMLEFT  , 0, TEXT("Image1 Text 5"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 0, DISPWIN_ALIGN_TOPCENTER   , 0, TEXT("Top"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Bottom"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 0, DISPWIN_ALIGN_TOPRIGHT    , 0, TEXT("Image1 Text 6"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 8, DISPWIN_ALIGN_TOPLEFT     , DISPWIN_TYPE_FRAME, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd, 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, 0); 
      return nRet; 
   } 
 
   // load another bitmap list 
   nRet = L_LoadBitmapList (MAKE_IMAGE_PATH(TEXT("mage2.dcm")), &hBitmapList, 0, ORDER_BGRORGRAY, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
 
   HWND hCellWnd1 = L_DispContainerCreateCell(hConWnd, 0); 
 
 
   // insert a new cell at the end of the container queue. 
   nCellIndex = L_DispContainerInsertCell (hCon, hCellWnd1, -1, 0); 
 
   // Attach the loaded bitmap list the newly inserted cell. 
   nRet = L_DispContainerSetCellBitmapList (hCellWnd1, 
                                           hBitmapList, 
                                           TRUE, 
                                           0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Add some tags to the cell 
   nRet = L_DispContainerSetCellTag (hCellWnd1, 0, DISPWIN_ALIGN_TOPLEFT     , 0,TEXT("Image3 Text 1"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 2, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 4, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 6, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 1, DISPWIN_ALIGN_LEFTCENTER  , 0, TEXT("Image3 Text 5"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 0, DISPWIN_ALIGN_BOTTOMLEFT  , 0, TEXT("Image3 Text 6"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 0, DISPWIN_ALIGN_TOPCENTER   , 0, TEXT("Image3 Text 7"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Image3 Text 8"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 0, DISPWIN_ALIGN_TOPRIGHT    , 0, TEXT("Image3 Text 9"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 7, DISPWIN_ALIGN_TOPLEFT     , DISPWIN_TYPE_SCALE, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_DispContainerSetCellTag(hCellWnd1, 1, DISPWIN_ALIGN_BOTTOMLEFT  , DISPWIN_TYPE_WLCENTERWIDTH, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_DispContainerSetSubCellTag(hCellWnd, 8, 0, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 1"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_DispContainerSetSubCellTag(hCellWnd1, 0, 8, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_DispContainerSetSubCellTag(hCellWnd1, 1, 9, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_DispContainerSetSubCellTag(hCellWnd1, 2, 10, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_DispContainerSetSubCellTag(hCellWnd1, 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(hCellWnd, &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(hCellWnd, 0); 
      L_DispContainerBeginUpdate(hCellWnd1, 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(hCellWnd, 0, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
 
   nRet = L_DispContainerDeleteCellTag(hCellWnd, 8, DISPWIN_ALIGN_TOPLEFT, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Shift the second row, one row down 
   nRet = L_DispContainerGetCellTag(hCellWnd, 2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   TagInfo.uPosition += 1; 
 
   nRet = L_DispContainerEditCellTag(hCellWnd, 2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Shift the second row, one row down 
   nRet = L_DispContainerGetSubCellTag(hCellWnd1, 0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   TagInfo.szText = TEXT("Edited sub-cell Tag1"); 
   L_DispContainerEditSubCellTag(hCellWnd1, 0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
 
   L_DispContainerDeleteSubCellTag(hCellWnd, 0, 8, DISPWIN_ALIGN_TOPLEFT, 0); 
 
   L_DispContainerAddAction(hCellWnd, CONTAINER_ACTION_WINDOWLEVEL, 0); 
   L_DispContainerSetAction(hCellWnd, CONTAINER_ACTION_WINDOWLEVEL, CONTAINER_MOUSE_BUTTON_LEFT, 0); 
   L_DispContainerAddAction(hCellWnd, CONTAINER_ACTION_ALPHA, 0); 
   L_DispContainerAddAction(hCellWnd, CONTAINER_ACTION_OFFSET , 0); 
   L_DispContainerAddAction(hCellWnd, CONTAINER_ACTION_MAG, 0); 
   L_DispContainerAddAction(hCellWnd, CONTAINER_ACTION_SCALE , 0); 
   L_DispContainerAddAction(hCellWnd, CONTAINER_ACTION_STACK , 0); 
 
   L_DispContainerAddAction(hCellWnd1, CONTAINER_ACTION_WINDOWLEVEL, 0); 
   L_DispContainerSetAction(hCellWnd1, CONTAINER_ACTION_WINDOWLEVEL, CONTAINER_MOUSE_BUTTON_LEFT, 0); 
   L_DispContainerAddAction(hCellWnd1, CONTAINER_ACTION_ALPHA, 0); 
   L_DispContainerAddAction(hCellWnd1, CONTAINER_ACTION_OFFSET , 0); 
   L_DispContainerAddAction(hCellWnd1, CONTAINER_ACTION_MAG, 0); 
   L_DispContainerAddAction(hCellWnd1, CONTAINER_ACTION_SCALE , 0); 
   L_DispContainerAddAction(hCellWnd1, CONTAINER_ACTION_STACK , 0); 
 
 
   DISPWLEVELACTIONPROPS DispContianerWindowLevel; 
   DispContianerWindowLevel.DispContainerActionProps.uStructSize = sizeof(DISPWLEVELACTIONPROPS); 
 
   L_DispContainerGetActionProperties(hCellWnd, CONTAINER_ACTION_WINDOWLEVEL, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CONTAINERLEVEL); 
   L_DispContainerGetActionProperties(hCellWnd, CONTAINER_ACTION_WINDOWLEVEL, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
 
   DispContianerWindowLevel.nWidth = 20; 
   DispContianerWindowLevel.nCenter = 50; 
 
   L_DispContainerSetActionProperties(hCellWnd, CONTAINER_ACTION_WINDOWLEVEL, -1, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
 
   L_DispContainerSetActionProperties(hCellWnd1, CONTAINER_ACTION_WINDOWLEVEL, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
 
   L_DispContainerGetCellScale(hCellWnd, 0, &dScale, 0); 
 
   dScale *= 2; 
 
   L_DispContainerSetCellScale(hCellWnd, -1, dScale, 0); 
 
   L_DispContainerSetCellScale(hCellWnd1, 0, dScale, 0); 
 
   L_DispContainerGetCellScaleMode(hCellWnd, 0, &uScaleMode, 0); 
 
   if (uScaleMode != CONTAINER_SCALEMODE_FIT) 
      uScaleMode = CONTAINER_SCALEMODE_FIT; 
   else 
      uScaleMode = CONTAINER_SCALEMODE_NORMAL; 
 
   L_DispContainerSetCellScaleMode(hCellWnd1, -1, uScaleMode, 0); 
 
   L_DispContainerSetCellScaleMode(hCellWnd, -1, uScaleMode, 0); 
 
   if (nMessageRet == IDYES) 
   { 
      L_DispContainerEndUpdate(hCellWnd, 0); 
      L_DispContainerEndUpdate(hCellWnd1, 0); 
   } 
 
   return SUCCESS; 
} 

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

LEADTOOLS Medical Image Viewer C API Help