LImageViewer::BeginUpdate

Summary

Stops the viewer from being refreshed if any change is applied, it is generally useful to increase the control speed efficiency. To resume refreshing, use the LImageViewer::EndUpdate function.

Syntax

#include "ltwrappr.h"

L_INT LImageViewer::BeginUpdate(uFlags)

Parameters

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 LImageViewer::EndUpdate. 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

See Also

Functions

Topics

Example

This example creates a medical viewer control and two cells, then asks 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_V175_OR_LATER 
L_INT LImageViewer_BeginUpdateExample(CWnd* pParent, LImageViewer& ImageViewer, LBitmapList BitmapList) 
{ 
   DISPCONTAINERPROPERTIES DispContainerProp; 
   DISPCELLPROPERTIES DispCellProp; 
   RECT rcRect; 
   L_INT nRet; 
   L_INT nCellIndex; 
   L_UINT uScaleMode; 
   // Create a container at a size of the its parent. 
   pParent->GetClientRect(&rcRect);  
   nRet = ImageViewer.Create (pParent->GetSafeHwnd(), &rcRect, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // 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 = ImageViewer.SetProperties ( &DispContainerProp, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // load a bitmap list. 
   nRet = BitmapList.Load(TEXT("C:\\LEADTOOLS22\\Resources\\Images\\xa.dcm"), 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) 
   { 
      ImageViewer.Destroy (0); 
      return nRet; 
   } 
   LImageViewerCell * ImageViewerCell = new LImageViewerCell(); 
   ImageViewerCell->Create(ImageViewer.GetWindowHandle(0), 0); 
   // Insert a new cell at the end of the container cell queue. 
   nCellIndex = ImageViewer.InsertCell(ImageViewerCell->GetWindowHandle(0),  -1, 0); 
   // Attach the loaded bitmaplist to the newly inserted cell. 
   nRet = ImageViewerCell->SetCellBitmapList(BitmapList.GetHandle(), 
                                        TRUE, 
                                        0); 
   if(nRet != SUCCESS) 
      return nRet; 
   BitmapList.SetHandle(NULL,NULL,FALSE);  
   // Add some tags to the cell 
   ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 1"), 0); 
   nRet = ImageViewerCell->SetCellTag( 1, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(2, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(3, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(1, DISPWIN_ALIGN_LEFTCENTER  , 0, TEXT("L"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_BOTTOMLEFT  , 0, TEXT("Image1 Text 5"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_TOPCENTER   , 0, TEXT("Top"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Bottom"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_TOPRIGHT    , 0, TEXT("Image1 Text 6"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(8, DISPWIN_ALIGN_TOPLEFT     , DISPWIN_TYPE_FRAME, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(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) 
   { 
      ImageViewer.Destroy (0); 
      return nRet; 
   } 
   // load another bitmap list 
   nRet = BitmapList.Load(TEXT("C:\\LEADTOOLS22\\Resources\\Images\\image2.dic"), 0, ORDER_BGRORGRAY, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   ImageViewerCell = new LImageViewerCell(); 
   ImageViewerCell->Create(ImageViewer.GetWindowHandle(0), 0); 
   // insert a new cell at the end of the container queue. 
   ImageViewer.InsertCell (ImageViewerCell->GetWindowHandle(0), -1, 0); 
   // Attach the loaded bitmap list the newly inserted cell. 
   nRet = ImageViewerCell->SetCellBitmapList (BitmapList.GetHandle(), 
                                         TRUE, 
                                         0); 
   if(nRet != SUCCESS) 
      return nRet; 
   BitmapList.SetHandle(NULL,NULL,FALSE);  
   // Add some tags to the cell 
   nRet = ImageViewerCell->SetCellTag (0, DISPWIN_ALIGN_TOPLEFT     , 0,TEXT("Image3 Text 1"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(2, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(4, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(6, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(1, DISPWIN_ALIGN_LEFTCENTER  , 0, TEXT("Image3 Text 5"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_BOTTOMLEFT  , 0, TEXT("Image3 Text 6"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_TOPCENTER   , 0, TEXT("Image3 Text 7"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Image3 Text 8"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_TOPRIGHT    , 0, TEXT("Image3 Text 9"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(7, DISPWIN_ALIGN_TOPLEFT     , DISPWIN_TYPE_SCALE, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetCellTag(1, DISPWIN_ALIGN_BOTTOMLEFT  , DISPWIN_TYPE_WLCENTERWIDTH, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetSubCellTag(8, 0, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 1"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetSubCellTag(0, 8, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetSubCellTag(1, 9, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetSubCellTag(2, 10, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewerCell->SetSubCellTag(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; 
   ImageViewerCell = ImageViewer.GetCellHandle(0, 0); 
   LImageViewerCell * ImageViewerCell1 = ImageViewer.GetCellHandle(1, 0); 
   nRet = ImageViewerCell->SetCellProperties(&DispCellProp, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   pParent->ShowWindow(SW_MAXIMIZE); 
   pParent->UpdateWindow(); 
   L_INT nMessageRet = pParent->MessageBox(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) 
   { 
      ImageViewerCell->BeginUpdate( 0); 
      ImageViewerCell1->BeginUpdate(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; 
   ImageViewerCell->EditCellTag(0, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   nRet = ImageViewerCell->DeleteCellTag(8, DISPWIN_ALIGN_TOPLEFT, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Shift the second row, one row down 
   nRet = ImageViewerCell->GetCellTag(2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   TagInfo.uPosition += 1; 
   nRet = ImageViewerCell->EditCellTag(2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Shift the second row, one row down 
   nRet = ImageViewerCell1->GetSubCellTag(0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   TagInfo.szText = TEXT("Edited sub-cell Tag1"); 
   ImageViewerCell1->EditSubCellTag(0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   ImageViewerCell->DeleteSubCellTag(0, 8, DISPWIN_ALIGN_TOPLEFT, 0); 
   ImageViewerCell->AddAction( CONTAINER_ACTION_WINDOWLEVEL, 0); 
   ImageViewerCell->SetAction( CONTAINER_ACTION_WINDOWLEVEL, CONTAINER_MOUSE_BUTTON_LEFT, 0); 
   ImageViewerCell->AddAction( CONTAINER_ACTION_ALPHA, 0); 
   ImageViewerCell->AddAction( CONTAINER_ACTION_OFFSET , 0); 
   ImageViewerCell->AddAction( CONTAINER_ACTION_MAG, 0); 
   ImageViewerCell->AddAction( CONTAINER_ACTION_SCALE , 0); 
   ImageViewerCell->AddAction( CONTAINER_ACTION_STACK , 0); 
   DISPWLEVELACTIONPROPS DispContianerWindowLevel; 
   DispContianerWindowLevel.DispContainerActionProps.uStructSize = sizeof(DISPWLEVELACTIONPROPS); 
   ImageViewerCell->GetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CONTAINERLEVEL); 
   ImageViewerCell->GetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
   DispContianerWindowLevel.nWidth = 20; 
   DispContianerWindowLevel.nCenter = 50; 
   ImageViewerCell->SetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, -1, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
   ImageViewerCell1 = ImageViewer.GetCellHandle(1, 0); 
   ImageViewerCell1->SetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
   ImageViewerCell->GetCellScale(0, &dScale, 0); 
   dScale *= 2; 
   ImageViewerCell->SetCellScale(-1, dScale, 0); 
   if (!ImageViewerCell->IsBitmapFlipped(0, 0)) 
      ImageViewerCell->FlipBitmap(-1, 0); 
   if (!ImageViewerCell->IsBitmapReversed(0, 0)) 
      ImageViewerCell->ReverseBitmap(-1, 0); 
   ImageViewerCell1->SetCellScale(0, dScale, 0); 
   ImageViewerCell->GetCellScaleMode(0, &uScaleMode, 0); 
   if (uScaleMode != CONTAINER_SCALEMODE_FIT) 
      uScaleMode = CONTAINER_SCALEMODE_FIT; 
   else 
      uScaleMode = CONTAINER_SCALEMODE_NORMAL; 
   ImageViewerCell1->SetCellScaleMode(-1, uScaleMode, 0); 
   ImageViewerCell->SetCellScaleMode(-1, uScaleMode, 0); 
   if (nMessageRet == IDYES) 
   { 
      ImageViewerCell->EndUpdate( 0); 
      ImageViewerCell->EndUpdate(0); 
   } 
   return SUCCESS; 
} 
#else 
L_INT ImageViewer_BeginUpdateExample(CWnd* pParent, LImageViewer& ImageViewer, LBitmapList BitmapList) 
{ 
   DISPCONTAINERPROPERTIES DispContainerProp; 
   DISPCELLPROPERTIES DispCellProp; 
   RECT rcRect; 
   L_INT nRet; 
   L_INT nCellIndex; 
   L_UINT uScaleMode; 
   // Create a container at a size of the its parent. 
   pParent->GetClientRect(&rcRect);  
   nRet = ImageViewer.Create (pParent->GetSafeHwnd(), &rcRect, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // 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 = ImageViewer.SetProperties ( &DispContainerProp, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // load a bitmap list. 
   nRet = BitmapList.Load(TEXT("C:\\LEADTOOLS22\\Resources\\Images\\xa.dcm"), 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) 
   { 
      ImageViewer.Destroy ( FALSE, 0); 
      return nRet; 
   } 
   // Insert a new cell at the end of the container cell queue. 
   nCellIndex = ImageViewer.InsertCell( -1, 0); 
   // Attach the loaded bitmaplist to the newly inserted cell. 
   nRet = ImageViewer.SetCellBitmapList(nCellIndex, 
                                        BitmapList.GetHandle(), 
                                        TRUE, 
                                        0); 
   if(nRet != SUCCESS) 
      return nRet; 
   BitmapList.SetHandle(NULL,NULL,FALSE);  
   // Add some tags to the cell 
   ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 1"), 0); 
   nRet = ImageViewer.SetCellTag( nCellIndex, 1, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 2, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 3, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image1 Text 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 1, DISPWIN_ALIGN_LEFTCENTER  , 0, TEXT("L"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_BOTTOMLEFT  , 0, TEXT("Image1 Text 5"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_TOPCENTER   , 0, TEXT("Top"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Bottom"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_TOPRIGHT    , 0, TEXT("Image1 Text 6"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 8, DISPWIN_ALIGN_TOPLEFT     , DISPWIN_TYPE_FRAME, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( 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) 
   { 
      ImageViewer.Destroy ( FALSE, 0); 
      return nRet; 
   } 
   // load another bitmap list 
   nRet = BitmapList.Load(TEXT("C:\\LEADTOOLS22\\Resources\\Images\\image2.dic"), 0, ORDER_BGRORGRAY, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   // insert a new cell at the end of the container queue. 
   nCellIndex = ImageViewer.InsertCell ( -1, 0); 
   // Attach the loaded bitmap list the newly inserted cell. 
   nRet = ImageViewer.SetCellBitmapList (nCellIndex, 
                                         BitmapList.GetHandle(), 
                                         TRUE, 
                                         0); 
   if(nRet != SUCCESS) 
      return nRet; 
   BitmapList.SetHandle(NULL,NULL,FALSE);  
   // Add some tags to the cell 
   nRet = ImageViewer.SetCellTag ( nCellIndex, 0, DISPWIN_ALIGN_TOPLEFT     , 0,TEXT("Image3 Text 1"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 2, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 4, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 6, DISPWIN_ALIGN_TOPLEFT     , 0, TEXT("Image3 Text 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 1, DISPWIN_ALIGN_LEFTCENTER  , 0, TEXT("Image3 Text 5"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_BOTTOMLEFT  , 0, TEXT("Image3 Text 6"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_TOPCENTER   , 0, TEXT("Image3 Text 7"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_BOTTOMCENTER, 0, TEXT("Image3 Text 8"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_TOPRIGHT    , 0, TEXT("Image3 Text 9"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 0, DISPWIN_ALIGN_RIGHTCENTER , 0, TEXT("R"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 7, DISPWIN_ALIGN_TOPLEFT     , DISPWIN_TYPE_SCALE, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetCellTag( nCellIndex, 1, DISPWIN_ALIGN_BOTTOMLEFT  , DISPWIN_TYPE_WLCENTERWIDTH, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetSubCellTag( 0, 8, 0, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 1"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetSubCellTag( 1, 0, 8, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 2"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetSubCellTag( 1, 1, 9, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 3"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetSubCellTag( 1, 2, 10, DISPWIN_ALIGN_TOPLEFT, DISPWIN_TYPE_USERDATA, TEXT("Sub Cell Tag 4"), 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = ImageViewer.SetSubCellTag( 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 = ImageViewer.SetCellProperties( 0, &DispCellProp, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   pParent->ShowWindow(SW_MAXIMIZE); 
   pParent->UpdateWindow(); 
   L_INT nMessageRet = pParent->MessageBox(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) 
      ImageViewer.BeginUpdate( 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; 
   ImageViewer.EditCellTag( 0, 0, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   nRet = ImageViewer.DeleteCellTag( 0, 8, DISPWIN_ALIGN_TOPLEFT, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Shift the second row, one row down 
   nRet = ImageViewer.GetCellTag( 0, 2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   TagInfo.uPosition += 1; 
   nRet = ImageViewer.EditCellTag( 0, 2, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Shift the second row, one row down 
   nRet = ImageViewer.GetSubCellTag( 1, 0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   TagInfo.szText = TEXT("Edited sub-cell Tag1"); 
   ImageViewer.EditSubCellTag( 1, 0, 8, DISPWIN_ALIGN_TOPLEFT, &TagInfo, 0); 
   ImageViewer.DeleteSubCellTag( 0, 0, 8, DISPWIN_ALIGN_TOPLEFT, 0); 
   ImageViewer.AddAction( CONTAINER_ACTION_WINDOWLEVEL, 0); 
   ImageViewer.SetAction( CONTAINER_ACTION_WINDOWLEVEL, CONTAINER_MOUSE_BUTTON_LEFT, 0); 
   ImageViewer.AddAction( CONTAINER_ACTION_ALPHA, 0); 
   ImageViewer.AddAction( CONTAINER_ACTION_OFFSET , 0); 
   ImageViewer.AddAction( CONTAINER_ACTION_MAG, 0); 
   ImageViewer.AddAction( CONTAINER_ACTION_SCALE , 0); 
   ImageViewer.AddAction( CONTAINER_ACTION_STACK , 0); 
   DISPWLEVELACTIONPROPS DispContianerWindowLevel; 
   DispContianerWindowLevel.DispContainerActionProps.uStructSize = sizeof(DISPWLEVELACTIONPROPS); 
   ImageViewer.GetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, 0, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CONTAINERLEVEL); 
   ImageViewer.GetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, 0, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
   DispContianerWindowLevel.nWidth = 20; 
   DispContianerWindowLevel.nCenter = 50; 
   ImageViewer.SetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, 0, -1, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
   ImageViewer.SetActionProperties( CONTAINER_ACTION_WINDOWLEVEL, 1, 0, &DispContianerWindowLevel, CONTAINER_ACTION_CELLLEVEL); 
   ImageViewer.GetCellScale( 0, 0, &dScale, 0); 
   dScale *= 2; 
   ImageViewer.SetCellScale( 0, -1, dScale, 0); 
   if (!ImageViewer.IsBitmapFlipped(0, 0, 0)) 
      ImageViewer.FlipBitmap(0, -1, 0); 
   if (!ImageViewer.IsBitmapReversed(0, 0, 0)) 
      ImageViewer.ReverseBitmap(0, -1, 0); 
   ImageViewer.SetCellScale( 1, 0, dScale, 0); 
   ImageViewer.GetCellScaleMode( 0, 0, &uScaleMode, 0); 
   if (uScaleMode != CONTAINER_SCALEMODE_FIT) 
      uScaleMode = CONTAINER_SCALEMODE_FIT; 
   else 
      uScaleMode = CONTAINER_SCALEMODE_NORMAL; 
   ImageViewer.SetCellScaleMode( 1, -1, uScaleMode, 0); 
   ImageViewer.SetCellScaleMode( 0, -1, uScaleMode, 0); 
   if (nMessageRet == IDYES) 
      ImageViewer.EndUpdate( 0); 
   return SUCCESS; 
} 
#endif // LTVXX_CONFIG 

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

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