ImageEn, unit ievect

TImageEnVect.SetObjRect

TImageEnVect.SetObjRect


Declaration

procedure SetObjRect(hobj: integer; const Rect: TRect; bMaintainAspectRatio : Boolean = False);


Description

Specifies the coordinates of hobj object.

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.

If bMaintainAspectRatio and hObj is a iekBITMAP type then Rect will be adjusted so that the image does not appear stretched


Example

// Add an image object from file and size it while maintaining its aspect ratio
aBitmap := TIEBitmap.Create;
try
  aBitmap.LoadFromFile( 'd:\002.png' );
  hObj := ImageEnVect1.AddNewObject();
  ImageEnVect1.ObjKind[ hObj ] := iekBITMAP;
  ImageEnVect1.ObjBitmap[ hObj ] := aBitmap;
  ImageEnVect1.SetObjRect( hobj, Rect( 100, 100, 200, 200 ), True );
finally
  aBitmap.Free;
end;


Transition Information

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

ImageEnView1.CurrentLayer.ClientAreaBox := Rect( ... );
ImageEnView1.Update();