L_AnnCreate

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnCreate(uObjectType, phObject)

L_UINT uObjectType;

/* type of annotation object to create */

pHANNOBJECT phObject;

/* address of the variable to be updated */

Creates an annotation object of the specified type.

This function is available in the Document and Medical Imaging toolkits.

Parameter

Description

uObjectType

The type of annotation object to create. For descriptions of object types, refer to Types of Annotations.

phObject

Address of the variable to be updated with the handle to the new annotation object.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

(Document and Medical) Before calling this function, you must declare a variable of data type HANNOBJECT. Then, pass the address of the variable in the phObject parameter. This function will update the variable with the handle of the new annotation object.

You must use the L_AnnSet... functions to initialize the object after it is created.

You should not call this function during processing of WM_LTANNEVENT if wParam equals LTANNEVENT_REMOVE or LTANNEVENT_INSERT, or during the ANNENUMCALLBACK callback function

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.

Platforms

Windows 2000 / XP/Vista.

See Also

Functions:

L_AnnCreateContainer, L_AnnCreateItem,

 

L_AnnDefine, L_AnnInsert, L_AnnRemove,

 

L_AnnDestroy, L_AnnAddUserHandle, L_AnnAdjustPoint, L_AnnChangeUserHandle, L_AnnConvert, L_AnnDefine2, L_AnnDeleteUserHandle, L_AnnEnumerateHandles, L_AnnGetRestrictToContainer, L_AnnGetRotateAngle, L_AnnGetUserHandle, L_AnnGetUserHandles, L_AnnHitTest, L_AnnRestrictCursor, L_AnnSetRestrictToContainer

Topics:

Annotation Functions: Creating and Deleting Annotations

 

Implementing Annotations

 

Annotation Objects - Default Values

 

Annotation Objects - Automated Features

 

Types of Annotations

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

 

Implementing Custom Annotations

Example

For complete sample code, refer to the ANNOTATE example. This example creates a line object, inserts it into the existing container, and displays the line. This function must be called AFTER a container has been created. For example, after TestCreateAnn in Implementing a Non-automated Annotation Program.

 L_INT AnnCreateExample(HWND           hWnd,
                                       HANNOBJECT     hContainer,/* Container annotation object */
                                       HANNOBJECT     MyLine)    /* Line annotation object */
{
   L_INT nRet;
   HDC         hWindowDC;  /* Device context of the current window */
   ANNRECT     ContainerRect;
   ANNRECT     ContainerRectName;
   ANNPOINT    MyLinePts[2];
   pANNPOINT   pMyLinePts = MyLinePts;
   RECT        rAnnBounds;
   RECT        rAnnBoundsName;

   /* Get the device context of the current window */
   hWindowDC = GetDC (hWnd);
   /* Create the Line Annotation and insert it into the container */
   nRet = L_AnnCreate(ANNOBJECT_LINE, &MyLine);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_AnnInsert(hContainer, MyLine, FALSE);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_AnnSetVisible(MyLine, TRUE, 0, NULL);
   if(nRet != SUCCESS)
      return nRet;
   /* Get the container rectangle to use for positioning the line */
   nRet = L_AnnGetRect(hContainer, &ContainerRect, &ContainerRectName);
   if(nRet != SUCCESS)
      return nRet;
   /* Position the line */
   pMyLinePts[0].x = 0;
   pMyLinePts[0].y = 0;
   pMyLinePts[1].x = ContainerRect.right / 2;
   pMyLinePts[1].y = ContainerRect.bottom / 2;
   nRet = L_AnnSetPoints(MyLine, pMyLinePts, 2);
   if(nRet != SUCCESS)
      return nRet;
   /* Display the line */
   nRet = L_AnnGetBoundingRect(MyLine, &rAnnBounds, &rAnnBoundsName);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_AnnDraw(hWindowDC, &rAnnBounds, MyLine);
   if(nRet != SUCCESS)
      return nRet;
   /* Remove the queued paint message */
   ValidateRect(hWnd, &rAnnBounds);
   ReleaseDC(hWnd, hWindowDC);
   return SUCCESS;
}