Board index » delphi » free thumbnail image

free thumbnail image

The real trick to thumbnails is to simply paint only what you need at the
moment you need it.  So,  using components isn't very efficient.  TBitmaps
won't work either because you could run out of handles real fast causing
some annoying problems.

I'm not allowed to post company code,  but I can tell you that the way I
approached the problem was to use a TListView control in virtual mode.  I
then assigned an imagelist to the listview but did NOT add any images to the
ImageList.  I simply set the image list width and height properties so that
the listview would return the proper display rectangles when requested.
Additionally,  I set the ListView to Icon display mode so that the thumbnail
image was drawn with the caption neatly underneath.

The listview proved to be an excellent container for this type job - but be
warned it is still less than perfect.
Finally,  since the listview is running in virtual mode,  I used a TList to
hold sets of Bitmap Bits and some other data which I converted to TBitmap on
demand for display.

Regards

 

Re:free thumbnail image


On D? 09 ?? 2002 11:05:08p , "Jodahush" <hu...@web.de> wrote in
news:3d542081$1_2@dnews

Quote
> I created thumbnail images on a srollbox. First I created a object based
on
> tcustomcomponent, which contains a TPicture.
> The parent of this object is the Scrollbox.

> When it comes to eliminating those pictures I am stucked. I can not free
> thos objects.

> I tried to add every object into a tlist, but I receive an address error.

> However with

> with scrollbox1 do
> begin
> if componentcount>0 then
>  components[0].free;
> end;
> end;

> I free the suff, but the images do not disapear.

> With scrollbox1.RemoveComponent(ANewThumb), I only can remove the last
> thumbnail object.

> What can I do?

How about this.

Procedure ClearScrollBox(aBox:TscrollBox);
Var
  aComp :TComponent;
begin
  While Abox.ComponentCount> 0 do
  begin
    Acomp := ABox.Components[0];
    AComp.Parent:=Nil;
    FreeAndNil(AComp);
  end;
end;

Regards
Johnnie.

Other Threads