L_DispContainerGetDefaultWindowLevelValues

#include "l_bitmap.h"

L_LTIVW_API L_INT EXT_FUNCTION L_DispContainerGetDefaultWindowLevelValues(hCellWnd, nSubCellIndex, pnWidth, pnCenter, uFlags)

HWND hCellWnd;

/* handle to the cell window */

L_INT nSubCellIndex;

/* index into the image list attached to the cell */

L_INT * pnWidth;

/* pointer to a variable to be updated */

L_INT * pnCenter;

/* pointer to a variable to be updated */

L_UINT uFlags;

/* reserved for future use */

Gets the window level default values that are set when loading the image.

Parameter

Description

hCellWnd

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

nSubCellIndex

A zero-based index into the image list attached to the cell specified in nCellIndex. This image contains the default window level values being retrieved. Pass -2 to retrieves the default window level values of the selected sub-cell.

pnWidth

Address of the variable to be updated with the default window level width value.

pnCenter

Address of the variable to be updated with the default window level center value.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function will not get the current window level values. To get the current window level values call L_DispContainerGetActionProperties. To set the current window level values call L_DispContainerSetActionProperties

This function will not get the current window level values; it will get the default ones. The default values can be set using either by using L_DispContainerSetDefaultWindowLevelValues or can be internally calculated when the images are first set in the control using either L_DispContainerSetCellBitmapList or L_DispContainerSetRequestedImage (when the low memory usage feature is enabled). For more information about the low memory usage feature, refer to the function L_DispContainerEnableCellLowMemoryUsage.

To reset the window level values to the default values use the function L_DispContainerResetWindowLevelValues.

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_DispContainerResetWindowLevelValues, L_DispContainerSetDefaultWindowLevelValues, L_DispContainerGetActionProperties, L_DispContainerGetActionProperties, L_DispContainerCreate, L_DispContainerDestroy, L_DispContainerEnableCellLowMemoryUsage, L_DispContainerInsertCell, L_DispContainerSetRequestedImage, L_DispContainerSetLowMemoryUsageCallBack, L_DispContainerSetCellBitmapList

Topics:

Applying Actions

 

Image Viewer Functions: Applying Actions

Example

This examples changes the default window level value by decrease the width by 100. Then resets the images based on the new value.

#if defined LEADTOOLS_V17_OR_LATER
#if defined (LEADTOOLS_V16_OR_LATER)
L_INT DispContainerGetDefaultWindowLevelExamples(HDISPCONTAINER hCon)
{
   L_INT nRet;
   L_INT nWidth;
   L_INT nCenter;

   if (L_DispContainerGetCellCount(hCon, 0) == 0)
   {
      MessageBox(NULL, TEXT("you must at least have one cell added to the viewer"), TEXT("No Cell attached"), MB_OK);
      return FAILURE;
   }

   HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, 0, 0);


   nRet = L_DispContainerGetDefaultWindowLevelValues(hCellWnd, 0, &nWidth, &nCenter, 0);
   if (nRet != SUCCESS)
      return nRet;

   nWidth -= 100;

   nRet = L_DispContainerSetDefaultWindowLevelValues(hCellWnd, 0, nWidth, nCenter, 0);
   if (nRet != SUCCESS)
      return nRet;

   nRet = L_DispContainerResetWindowLevelValues(hCellWnd, 0, 0);
   if (nRet != SUCCESS)
      return nRet;

   return SUCCESS;
}
#endif

#else



#if defined (LEADTOOLS_V16_OR_LATER)
L_INT DispContainerGetDefaultWindowLevelExamples(HDISPCONTAINER hCon)
{
   L_INT nRet;
   L_INT nWidth;
   L_INT nCenter;

   nRet = L_DispContainerGetDefaultWindowLevelValues(hCon, 0, 0, &nWidth, &nCenter, 0);
   if (nRet != SUCCESS)
      return nRet;

   nWidth -= 100;

   nRet = L_DispContainerSetDefaultWindowLevelValues(hCon, 0, 0, nWidth, nCenter, 0);
   if (nRet != SUCCESS)
      return nRet;

   nRet = L_DispContainerResetWindowLevelValues(hCon, 0, 0, 0);
   if (nRet != SUCCESS)
      return nRet;

   return SUCCESS;
}
#endif

#endif