ImageEn, unit ievect

TImageEnVect.GetObjRect

TImageEnVect.GetObjRect


Declaration

procedure GetObjRect(hobj: integer; var Rect: TRect);


Description

GetObjRect returns the coordinates of hobj object. Note: For objects such as lines, the Rect.Top/Left may exceed Rect.Bottom/Right to indicate the direction of line drawing.

hobj is the ID of the object. You can also specify IEV_NEXT_INSERTED_OBJECT (-1) which refers to the next object to be inserted or IEV_PREVIOUS_INSERTED_OBJECT (-2) for the last object inserted.
     

Example

var
  r: TRect;
  hobj: Integer;
  sXDir, sYDir: string;
begin
  if ImageEnVect1.SelObjectsCount > 0 then
  begin
    hobj := ImageEnVect1.SelObjects[ 0 ];
    if ImageEnVect1.ObjKind[ hObj ] <> iekLINE then
      Caption := 'Not a line'
    else
    begin
      ImageEnVect1.GetObjRect( hobj, r );
      if  r.Top > r.Bottom then
        sYDir := 'Bottom-'
      else
        sYDir := 'Top-';
      if  r.Left > r.Right then
        sXDir := 'Right'
      else
        sXDir := 'Left';
      Caption := 'Line starts at ' + sYDir + sXDir;
    end;
  end;
end;


Transition Information

If you are transitioning your code to TImageEnView Layers, instead of GetObjRect, use: TIELayer.LayerRect

r := ImageEnView1.CurrentLayer.LayerRect;