Lazarus

Miscellaneous => Suggestions => LCL => Topic started by: alejol0 on August 17, 2010, 09:18:07 pm

Title: ListView with background image
Post by: alejol0 on August 17, 2010, 09:18:07 pm
Hi!

How to put a image as a background in a TListView component?

It will be great if one can write some like
TListView1.Background :='C:\MyFavouriteImage.BMP'

I think that with this property,it will be more easy to create a
desktop-like application.

For example, WineXO do not have desktop icons, and one can
mimic a real Windows desktop using this feature.

Thanks!
Title: Re: ListView with background image
Post by: Cigydd on August 26, 2016, 10:05:12 am
I'm sorry to dig up an old thread but I'd like to know how to do exactly the same thing. Found some Delphi stuff but it involves the Windows API that can't be used on Linux, as obvious.
Tried to set the OwnerDraw property to True and wrote an event handler:
Code: Pascal  [Select]
  1. procedure TFrmResults.lvResultsCustomDraw(Sender: TCustomListView;
  2.   const ARect: TRect; var DefaultDraw: Boolean);
  3. begin
  4.   Canvas.CopyRect(ARect, FrmMinigolfeeCheck.imgTerrain.Canvas, ARect);
  5.   DefaultDraw:=True;
  6. end;
  7.  
But the list items are drawn badly; it seems that setting DefaultDraw to True doesn't work and I don't seem to see the background image. Or am I missing something?