#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerAnnToRgn(hCellWnd, nSubCellIndex, uCombineMode, bDeleteAnn, uFlags)

Converts a selected annotation object inside a specific cell or sub-cell into a region, this region will be either set or combined with another existing region.


L_HWND hCellWnd

A handle to the window that represents the cell on which the function's effect will be applied.

L_INT nSubCellIndex

A zero-based index into the image list attached to the cell specified in nCellIndex. This image contains the annotation object that the user chooses to convert into region. Pass -1 to apply this effect on all sub-cells. Pass -2 to apply this effect on the selected sub-cell.

L_UINT uCombineMode

Value that specifies the action to apply on the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Creating a Bitmap Region Inside the Image Viewer.

L_BOOL bDeleteAnn

Flag that indicates whether to delete the annotation object after converting it to a region. Possible values are:

Value Meaning
TRUE Delete the annotation object after completing the process.
FALSE Do not delete the annotation object after completing the process.

L_UINT uFlags

Reserved for future use. Pass 0.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


The chosen sub-cell or cell must have a selected annotation in order to convert it into a region. If there is no selected annotation, the function will return ERROR_INV_PARAMETER.

This function works only on the closed shape annotation objects, such as rectangle, ellipse and Hilite.

If you have a cell with one image, you must set nSubCellIndex to zero.

Required DLLs and Libraries

See Also




This function inverts a region inside the bitmap, we assumed that we have one cell, and there is a selected rectangular or elliptical annotation on it.

L_INT DispContainerAnnToRgnExample(HDISPCONTAINER hCon)  
   L_INT        nRet; 
   L_INT nCellIndex = 0; 
   HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, nCellIndex, 0); 
   nRet = L_DispContainerAnnToRgn(hCellWnd, -2, L_RGN_SET, TRUE, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   // Just apply the effect on the active sub-cell. 
   // this is done by setting the nSubCell parameter to -2. 
   nRet = L_DispContainerGetBitmapHandle(hCellWnd, -2, &Bitmap, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   nRet = L_InvertBitmap(&Bitmap, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   nRet = L_DispContainerSetBitmapHandle(hCellWnd, -2, &Bitmap, FALSE, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   // Repaint the cell after the user is done with the changes. 
   nRet = L_DispContainerRepaintCell(hCellWnd, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 

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

LEADTOOLS Medical Image Viewer C API Help