L_AnnSelectRect

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_AnnSelectRect(hObject, pRect)

HANNOBJECT hObject;

/* handle to the annotation object */

LPRECT pRect;

/* pointer to the Windows RECT structure */

Selects all objects within the specified rectangle, relative to the window. This function is available in the Document/Medical Toolkits.

Parameter

Description

hObject

Handle to the annotation object.

pRect

Pointer to the Windows RECT structure. Coordinates are relative to the associated window's client area.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Selecting an object sets its selected property to TRUE.

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 95 / 98 / Me, Windows 2000 / XP.

See Also

Functions:

L_AnnGetSelectRect, L_AnnGetSelectCount, L_AnnSelectPoint, L_AnnHitTest, L_AnnGetType, L_AnnSetSelected, L_AnnGetSelected, L_AnnGetSelectItems

Topics:

Annotation Functions: Using Window Coordinates to Select Objects

 

Annotation Functions: Object Information

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

 

Displaying and Manipulating Annotation Objects

Example

/* This example selects all objects in the top half of the client area, changes the 
background color of selected objects, and updates the display. */
HANNOBJECT hContainer; /* Container annotation object */
void TestAnnSelectRect(HWND hWnd)
{
   RECT rClientArea; /* Client area of the current window */
   RECT rSelectionRect; /* Bounding rectangle of selected objects */
   HDC hWindowDC;  /* Device context of the current window */
   RECT rAnnBounds; /* Bounding rectangle when displaying the note */
   L_UINT SelectCount; /* Number of objects selected */
   L_TCHAR szMessage[80]; /* Message buffer */
   /* Get the device context of the current window */
   hWindowDC = GetDC (hWnd);
   /* Get the client area of the current window */
   GetClientRect(hWnd,&rClientArea);
   /* Select the objects in the top half of the client area. Notice that
   some adjustments are required to ensure that the specified rectangle encloses
   all objects in the top half of the client area. */
   rSelectionRect.top = rClientArea.top - 1;
   rSelectionRect.left = rClientArea.left -1;
   rSelectionRect.right = rClientArea.right + 2;
   rSelectionRect.bottom = (rClientArea.bottom / 2) + 2;
   L_AnnSelectRect(hContainer, &rSelectionRect);
   /* Set the background color of selected objects */
   L_AnnSetBackColor(hContainer, RGB(255,0,0), 
      ANNFLAG_SELECTED|ANNFLAG_RECURSE);
   /* Get the bounding rectangle of selected objects */
   L_AnnGetSelectRect(hContainer, &rAnnBounds);
   /* Get the window's device context */
   hWindowDC = GetDC (hWnd);
   /* Display the change */
   L_AnnDraw(hWindowDC, &rAnnBounds, hContainer);
   /* Remove the queued paint message */
   ValidateRect(hWnd, &rAnnBounds);
   /* Get the number of objects selected */
   L_AnnGetSelectCount(hContainer, &SelectCount);
   /* Display a message box with the result */
   wsprintf (szMessage, TEXT("%d objects selected"), SelectCount);
   MessageBox (NULL, szMessage, TEXT("Notice"), MB_OK);
   return;
}