L_DispContainerFreezeSubCell

#include "l_bitmap.h"

L_LTIVW_API L_INT EXT_FUNCTION L_DispContainerFreezeSubCell(hCellWnd, nSubCellIndex, bFreeze, uFlags)

HWND hCellWnd;

/* handle to the cell window */

L_INT nSubCellIndex;

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

L_BOOL bFreeze;

/* flag */

L_UINT uFlags;

/* reserved for future use */

Freezes the sub-cell with the specified index.

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 sub-cell will be toggled to frozen or not frozen. Pass -1 to apply this effect on all sub-cells. Pass -2 to apply this effect on the selected sub-cell.

bFreeze

Flag that indicates whether to freeze or unfreeze the sub-cell at the specified index. Possible values are:

 

Value

Meaning

 

TRUE

Freeze the sub-cell.

 

FALSE

Unfreeze the sub-cell.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The properties of a frozen sub-cell cannot be modified except by manually setting them using L_DispContainerSetActionProperties function.

To determine whether a sub-cell is frozen, call the L_DispContainerIsSubCellFrozen function. To determine whether a cell is frozen, call L_DispContainerIsCellFrozen function.

To freeze all cells call L_DispContainerFreezeCell function.

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_DispContainerIsSubCellFrozen, L_DispContainerIsCellFrozen, L_DispContainerFreezeCell, L_DispContainerCreate, L_DispContainerRemoveCell, L_DispContainerInsertCell, L_DispContainerGetCellCount, L_DispContainerGetCellWindowHandle, L_DispContainerSetCellTag, L_DispContainerSetCellProperties, L_DispContainerGetCellProperties, L_DispContainerRepositionCell, L_DispContainerGetCellPosition, L_DispContainerSetCellBitmapList, L_DispContainerGetCellBitmapList, L_DispContainerGetCellBounds, L_DispContainerSelectCell, L_DispContainerIsCellSelected

Topics:

Image Viewer Cells

 

Image Viewer Functions: Image Viewer Cells

Example

This example will freeze the even subcell and then type the word frozen in the middle of the frozen sub-cells.

#if defined LEADTOOLS_V17_OR_LATER

#if defined (LEADTOOLS_V16_OR_LATER)
L_INT EXT_CALLBACK PostPaintCallBack (HWND hCellWnd,
                                      pDISPCONTAINERCELLINFO pCellInfo,
                                      L_VOID *               pUserData)
{
   UNREFERENCED_PARAMETER(hCellWnd);
   UNREFERENCED_PARAMETER(pUserData);

   if (L_DispContainerIsSubCellFrozen(hCellWnd, pCellInfo->nSubCellIndex, 0))
   {
      HPEN hPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
      HPEN hOldPen = SelectPen(pCellInfo->hDC, hPen);
      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.bottom);

      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.bottom);
      SelectPen(pCellInfo->hDC, hOldPen);
      DeletePen(hPen);
   }

   return SUCCESS;
}

L_INT DispContainerFreezeSubCellExample(HDISPCONTAINER hCon)
{
   L_INT       nRet;
   HBITMAPLIST hBitmapList;
   L_INT       nCount;
   L_INT       nI;
   DISPCONTAINERPOSTPAINTCALLBACK oldCallBack;
   L_VOID *                      pOldUserData;

   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_DispContainerGetCellBitmapList(hCellWnd, &hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;

   L_GetBitmapListCount(hBitmapList, (L_UINT *)&nCount);


   for (nI = 0; nI < nCount; nI++)
   {
      if (((nI >> 1) << 1) == nI )
         L_DispContainerFreezeSubCell(hCellWnd, nI, TRUE, 0);
   }

   L_DispContainerGetPostPaintCallBack(hCellWnd, &oldCallBack, &pOldUserData);

   L_DispContainerSetPostPaintCallBack(hCellWnd, PostPaintCallBack, (L_VOID *)hCon);

   L_DispContainerRepaintCell(hCellWnd, 0);
   return SUCCESS;
}
#endif

#else




#if defined (LEADTOOLS_V16_OR_LATER)
L_INT EXT_CALLBACK PostPaintCallBack (pDISPCONTAINERCELLINFO pCellInfo,
                                      L_VOID *               pUserData)
{
   HDISPCONTAINER hCon = (HDISPCONTAINER)pUserData;
   if (L_DispContainerIsSubCellFrozen(hCon, pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, 0))
   {
      HPEN hPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
      HPEN hOldPen = SelectPen(pCellInfo->hDC, hPen);
      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.bottom);

      MoveToEx(pCellInfo->hDC, pCellInfo->rcRect.right, pCellInfo->rcRect.top, NULL);
      LineTo(pCellInfo->hDC, pCellInfo->rcRect.left, pCellInfo->rcRect.bottom);
      SelectPen(pCellInfo->hDC, hOldPen);
      DeletePen(hPen);
   }

   return SUCCESS;
}

L_INT DispContainerFreezeSubCellExample(HDISPCONTAINER hCon)
{
   L_INT       nRet;
   HBITMAPLIST hBitmapList;
   L_INT       nCount;
   L_INT       nI;
   DISPCONTAINERPOSTPAINTCALLBACK oldCallBack;
   L_VOID *                      pOldUserData;

   nRet = L_DispContainerGetCellBitmapList(hCon, 0, &hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;

   L_GetBitmapListCount(hBitmapList, (L_UINT *)&nCount);


   for (nI = 0; nI < nCount; nI++)
   {
      if (((nI >> 1) << 1) == nI )
         L_DispContainerFreezeSubCell(hCon, 0, nI, TRUE, 0);
   }

   L_DispContainerGetPostPaintCallBack(hCon, &oldCallBack, &pOldUserData);

   L_DispContainerSetPostPaintCallBack(hCon, PostPaintCallBack, (L_VOID *)hCon);

   L_DispContainerRepaintCell(hCon, 0, 0, 0);
   return SUCCESS;
}
#endif

#endif