LAnnStamp::SetBitmap

#include "ltwrappr.h"

virtual L_INT LAnnStamp::SetBitmap(pBitmap, uFlags=0)

virtual L_INT LAnnStamp::SetBitmap(pBitmap, uFlags=0)

LBitmapBase L_FAR * pBitmap;

/* pointer to an LBitmapBase object */

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UINT uFlags;

/* flags that determine the object to process */

Sets the bitmap of the annotation object. This function is available in the Document/Medical Toolkits.

Parameter

Description

pBitmap

Pointer to the bitmap object referencing the bitmap object to assign to the specified object.

pBitmap

Pointer to the bitmap handle referencing the bitmap to assign to the specified object.

uFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

 

Value

Meaning

 

0

Process only the specified object.

 

ANNFLAG_SELECTED

[0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the LAnnotation::IsSelected and LAnnotation::SetSelected functions.

 

ANNFLAG_NOINVALIDATE

[0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTANN

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:

LAnnStamp::SetBitmap, Class Members

Topics:

Annotation Functions: Object Properties

 

Using Annotation Bitmap Objects

Example

This is an example for LAnnStamp::SetBitmap(pBitmap, uFlags=0), with pBitmap of type pBITMAPHANDLE:

void TestAddAnn(HWND hWnd, pBITMAPHANDLE pBitmap, LAnnContainer L_FAR * pAnnContainer, LAnnStamp L_FAR * pAnnStamp)
{
   HDC hWindowDC;  /* Device context of the current window */
   ANNRECT ContainerRect; /* Root container's rectangle */
   ANNRECT MyStampRect; /* Rectangle for the stamp object */
   RECT rAnnBounds; /* Bounding rectangle used to draw the object */
   
   /* Get the device context of the current window */
   hWindowDC = GetDC (hWnd);
   
   /* Get the container's rectangle */
   pAnnContainer->GetRect(&ContainerRect);
   
   /* Size and position the stamp, adjusting the height to keep the bitmap's aspect ratio */
   MyStampRect.left = ContainerRect.right / 8;
   MyStampRect.top = ContainerRect.bottom / 2;
   MyStampRect.right = ContainerRect.right  / 2;
   MyStampRect.bottom = MyStampRect.top +
      (((MyStampRect.right - MyStampRect.left) * BITMAPHEIGHT(pBitmap)) / BITMAPWIDTH(pBitmap));
   pAnnStamp->SetRect(&MyStampRect);

   /* Assign the bitmap to the stamp;*/
   pAnnStamp->SetBitmap(pBitmap,0);
   /* Display the stamp */
   pAnnStamp->GetBoundingRect(&rAnnBounds);
   pAnnStamp->Draw(hWindowDC, &rAnnBounds);
   ReleaseDC(hWnd, hWindowDC);

   /* Remove the queued paint message */
   ValidateRect(hWnd, &rAnnBounds);   
}

This is an example for LAnnStamp::SetBitmap(pBitmap, uFlags=0), with pBitmap of type LBitmapBase L_FAR:

void TestAddAnnBitmap(HWND hWnd, LBitmapBase L_FAR * pLBitmap, LAnnContainer L_FAR * pAnnContainer, LAnnStamp L_FAR * pAnnStamp)
{
   HDC hWindowDC;  /* Device context of the current window */
   ANNRECT ContainerRect; /* Root container's rectangle */
   ANNRECT MyStampRect; /* Rectangle for the stamp object */
   RECT rAnnBounds; /* Bounding rectangle used to draw the object */
   
   /* Get the device context of the current window */
   hWindowDC = GetDC (hWnd);
   
   /* Get the container's rectangle */
   pAnnContainer->GetRect(&ContainerRect);
   
   /* Size and position the stamp, adjusting the height to keep the bitmap's aspect ratio */
   MyStampRect.left = ContainerRect.right / 8;
   MyStampRect.top = ContainerRect.bottom / 2;
   MyStampRect.right = ContainerRect.right  / 2;
   MyStampRect.bottom = MyStampRect.top +
      (((MyStampRect.right - MyStampRect.left) * (pLBitmap->GetWidth())) / (pLBitmap->GetHeight()));
   
   pAnnStamp->SetRect(&MyStampRect);

   /* Assign the bitmap to the stamp;*/
   pAnnStamp->SetBitmap(pLBitmap,0);
   /* Display the stamp */
   pAnnStamp->GetBoundingRect(&rAnnBounds);
   pAnnStamp->Draw(hWindowDC, &rAnnBounds);
   ReleaseDC(hWnd, hWindowDC);

   /* Remove the queued paint message */
   ValidateRect(hWnd, &rAnnBounds);   
}