#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSelectRect(hObject, pRect)

Selects all objects within the specified rectangle, relative to the window.



Handle to the annotation object.


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


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


Selecting an object sets its selected property to TRUE.

Required DLLs and Libraries


Win32, x64.

See Also




This example selects all objects in the top half of the client area, changes the
background color of selected objects, and updates the display.

L_INT AnnSelectRectExample(HWND         hWnd, 
                                          HANNOBJECT   hContainer)/* Container annotation object */ 
   L_INT nRet; 
   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 */ 
   /* 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; 
   nRet = L_AnnSelectRect(hContainer, &rSelectionRect); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Set the background color of selected objects */ 
   nRet = L_AnnSetBackColor(hContainer, RGB(255,0,0),  
   if(nRet != SUCCESS) 
      return nRet; 
   /* Get the bounding rectangle of selected objects */ 
   nRet = L_AnnGetSelectRect(hContainer, &rAnnBounds); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Get the window's device context */ 
   hWindowDC = GetDC (hWnd); 
   /* Display the change */ 
   nRet = L_AnnDraw(hWindowDC, &rAnnBounds, hContainer); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Remove the queued paint message */ 
   ValidateRect(hWnd, &rAnnBounds); 
   /* Get the number of objects selected */ 
   nRet = L_AnnGetSelectCount(hContainer, &SelectCount); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Display a message box with the result */ 
   wsprintf (szMessage, TEXT("%d objects selected"), SelectCount); 
   MessageBox (NULL, szMessage, TEXT("Notice"), MB_OK); 
   return SUCCESS; 

Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help