TImageEnVect.ObjectsCount
Declaration
property ObjectsCount: integer; (Read-Only)
Description
Read ObjectsCount to determine the number of objects in the TImageEnVect component. Use
GetObjFromIndex to convert the index value to an Obj.
// Delete the objects of the specified layer
procedure DeleteObjectsOfLayer(iLayer : Integer);
var
i: integer;
ihobj: integer;
iobjLayer: integer;
begin
for i := ImageEnVect1.ObjectsCount - 1 downto 0 do
begin
ihobj := ImageEnVect1.GetObjFromIndex(i);
// if hobj is on current layer then delete the object
iobjLayer := ImageEnVect1.ObjLayer[ihobj];
if iobjLayer = iLayer then
ImageEnVect1.RemoveObject(ihobj);
end;
ImageEnVect1.Update();
end;
Transition Information
If you are transitioning your code to
TImageEnView Layers, instead of ObjectsCount, use:
TImageEnView.LayersCount.
Note: LayersCount also includes the background layer. So it is always >= 1
n := ImageEnView1.LayersCount;