L_DispContainerGetPaintCallBack

#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerGetPaintCallBack(hCellWnd, ppfnPaintCallBack, ppUserData)

HWND hCellWnd;

/* handle to the cell window */

DISPCONTAINERPAINTCALLBACK * ppfnPaintCallBack;

/* pointer to paint callback function */

LPVOID * ppUserData;

/* pointer to user data */

Gets the current paint callback function along with the user data, which were set using the L_DispContainerSetPaintCallBack function.

Parameter

Description

hCellWnd

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

ppfnPaintCallBack

Pointer to a pointer to a callback function to be updated with the last paint callback function set using the L_DispContainerSetPaintCallBack function.

ppUserData

Void pointer to be updated with the user defined data associated with the paint callback. If you are not interested in the user-defined data, pass NULL for this parameter.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To set the callback function used to handle painting, call L_DispContainerSetPaintCallBack.

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.

See Also

Functions:

DISPCONTAINERPAINTCALLBACK, L_DispContainerRepaintCell, L_DispContainerSetPaintCallBack.

Topics:

Image Viewer Cells

Image Viewer Functions: Image Viewer Cells

Example

This function set a paint call back that draws an ellipse in the middle of the cell.

#if defined LEADTOOLS_V17_OR_LATER

L_INT EXT_CALLBACK PaintCallBack(HWND hCellWnd, HDC hMemDC, LPRECT lpRect, L_INT, L_INT, L_VOID *)
{
   UNREFERENCED_PARAMETER(hCellWnd);
   Ellipse(hMemDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
   return SUCCESS;
}

L_INT DispContainerGetPaintCallBackExample(HDISPCONTAINER hCon) 
{
   L_INT nRet;

   DISPCONTAINERPAINTCALLBACK OldPaintCallBack;

   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_DispContainerGetPaintCallBack(hCellWnd, &OldPaintCallBack, NULL);

   nRet = L_DispContainerSetPaintCallBack(hCellWnd, PaintCallBack, NULL);

   return SUCCESS;
}

#else




L_INT EXT_CALLBACK PaintCallBack(HDC hMemDC, LPRECT lpRect, L_INT, L_INT, L_VOID *)
{
   Ellipse(hMemDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
   return SUCCESS;
}

L_INT DispContainerGetPaintCallBackExample(HDISPCONTAINER hCon) 
{
   L_INT nRet;

   DISPCONTAINERPAINTCALLBACK OldPaintCallBack;

   nRet = L_DispContainerGetPaintCallBack(hCon, &OldPaintCallBack, NULL);

   nRet = L_DispContainerSetPaintCallBack(hCon, PaintCallBack, NULL);

   return SUCCESS;
}

#endif