LVectorBase::GetObjectRect

#include "ltwrappr.h"

virtual L_INT LVectorBase::GetObjectRect(pRect, dwFlags=0)

RECT *pRect;

/* pointer to a RECT structure */

L_UINT32 dwFlags;

/* flag that indicates which object(s) to use */

Gets the physical bounding rectangle for the specified object(s).

Parameter

Description

pRect

Pointer to a RECT structure to be updated with the bounding rectangle of the specified object(s).

dwFlags

Flag that indicates which rectangle to use when updating the pRect parameter. Possible values are:

 

Value

Meaning

 

0

pRect will be updated with the rectangle containing all objects within the vector handle.

 

VECTOR_FLAGS_SELECTED_ONLY

pRect will be updated with the rectangle containing all selected objects within the vector handle.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Obtains the physical bounding rectangle of a single object, all selected objects, or all objects within the specified vector handle.

Required DLLs and Libraries

LVKRN

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:

LVectorBase::IsObjectSelected, LVectorBase::GetObjectRect, LVectorBase::HitTest

Topics:

Manipulating Objects or Vertices within a Vector Image

 

Vector Images: Obtaining Object Information

Example

LVectorBase::GetObjectRect()

Shows the physical extent of the all objects inside drawing.

L_INT LVectorBase__GetObjectRectExample(HWND hWnd)
{
   L_INT       nRet;
   RECT        rect;
   L_TCHAR     szBuffer[100];
   LVectorBase Vector;
   nRet = Vector.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 16\\Images\\test.dxf"));
   if(nRet != SUCCESS)
      return nRet;
   nRet = Vector.AttachToWindow(hWnd);
   if(nRet != SUCCESS)
      return nRet;
   GetClientRect(hWnd, &rect);
   nRet = Vector.SetViewport(&rect);
   if(nRet != SUCCESS)
      return nRet;
   // Get the rectangle of entire object 
   nRet = Vector.GetObjectRect(&rect);
   if(nRet != SUCCESS)
      return nRet;
   wsprintf( szBuffer, TEXT("%d, %d, %d, %d"),
             rect.left, rect.top, rect.right, rect.bottom );
   MessageBox( NULL, szBuffer, TEXT("Selected Objects Physical Extent"), 0 );
   return SUCCESS;
}