Recent

Author Topic: ListView with background image  (Read 9740 times)

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
ListView with background image
« 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!
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

Cigydd

  • New Member
  • *
  • Posts: 22
  • Programming for fun
    • My GitHub
Re: ListView with background image
« Reply #1 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?
Cigydd Bach

 

TinyPortal © 2005-2018