DelphiFAQ Home Search:

Putting a background image on a ListView (Delphi 7)


comments24 comments. Current rating: 3 stars (15 votes). Leave comments and/ or rate it.


I need to display a bitmap as a background picture in a TListView control and it seems not to work.
I send a message LVM_SETBKIMAGE with the handle to a TLVBkImage, but no success.


The code is ok but you need to change the handling of the WM_ERASEBKGND message by either traditional subclassing or - more Delphi style - defining your own TMyListView derived from TListView as shown in the example. Then change the declaration of your listview control from TListView to TMyListView (both in your DFM and in your PAS file) and it will work.


  1. I noticed that I had to provide a full path to the image file. Just the file name (even though it was located in the application directory) did not work.
  2. BenoƮt Thonnart, a reader of this page wrote me that after he added uses ComObj; to his (version of this) code, it worked.

You can download a complete demo project that will compile under Delphi 7 (and since it has the constant definitions integrated, also under Delphi 5 and Delphi 6). kB)

  TMyListView = class(TListView)
    procedure WndProc(var Message: TMessage);

procedure TMyListView.WndProc(var Message: TMessage);
  if Message.Msg = WM_ERASEBKGND then
    inherited WndProc(Message);

procedure TForm1.LVBGImage;
  FillChar(BKimg, SizeOf(BKimg), 0);
  BKimg.pszImage := PChar('c:\windows\angler.bmp');
  BKimg.xOffsetPercent := 0;
  BKimg.yOffsetPercent := 0;
  SendMessage(ListView1.Handle, LVM_SETTEXTBKCOLOR, 0, integer(CLR_NONE));
  SendMessage(ListView1.Handle, LVM_SETBKIMAGE, 0, integer(@BKimg));


You are on page 1 of 2, other pages: [1] 2
2005-12-12, 16:48:02
anonymous from Brazil  
Great idea!
2006-03-09, 09:00:46
Craig from United Kingdom  
I'd been looking for this FOREVER :D.

But how can I get it to load from a TBitmap instead of a file? I tried LVBKIF_STYLE_HBITMAP and LVBKIF_STYLE_MASK and it won't work...
2007-07-07, 16:30:07
anonymous from Sweden  
Thanks, but cannot get it to only show one image (instead of showing same image side by side of itself), anyone know how to fix? :)
2008-03-13, 21:35:14   (updated: 2008-03-13, 21:35:44)
from Indonesia  
how to insert the substiem in listview in delphi i have tried so many time but i can found until noW , would you like to help meIII
2008-12-23, 04:30:39
This doesn't work with Delphi2009 + Vista
2009-08-12, 11:35:09
anonymous from South Africa  
Hi, I need to display a .jpg image as a theme in delphi and i cant find any help online.
2012-09-14, 03:43:39
anonymous from Korea (R)  
2012-10-19, 11:18:48
Payday Loans otmnzd get been administering US persons <a href=' '>payday Advance uk</a> 0563 with hurried, easy payday loans representing elds, and we've lastly trumped-up our method! So instantly you extremely buoy delight in second agreements on prompt notes go forward, each finished upon <a href=' '>quick payday loans</a> 5623 the cyberspace, without whatever recognition evaluations. We've been excavation with River lendors representing the elapsed infrequent months, securing the boss interestingness percentages and secured <a href=' '>cash advances</a> 7119 consent representing EACH River appliers. Unfortunatley, in this far-reaching thrift, when maximal nation's monetary aspects assume't accomplish fresh, it moves us each. Thither's various judgments reason you want any additional notes, and at Payday Loans in Canada, we'system quick to accommodate the bridgework loans that Rivers desire. Contrivances amount up, brakes, automobile destroys, polyclinic pecker, furlough shopping. Any the impetus, we'system hither to support you entertain near between paydates. Try our payday loan servicing nowadays and you won't be discomfited. In near occasions, we buoy satisfy the notes you want, depositied the IDENTICAL time, at times inside an generation!
2012-10-21, 03:36:25
vorlar <a href=' '>pay day loans</a> 8]]] <a href=' '>pay day loan</a> 0930 <a href=' '>short term loan</a> 4658 <a href=' '>payday loans</a> >:-OOO <a href=' '>cash advance</a> 3899
2012-11-12, 05:04:05
coach001 from United States  
2013-01-26, 19:02:16
anonymous from China  
Sennheiser (Sennheiser)<a href=' http://www.64gbusbm../'>64gb usb memory sticks</a> from the German brand is the most prestigious in the field of high-fidelity <a href=';quicken 2013</a>headphones enthusiasts almost<a href=''>dr dre earphones</a> everyone knows, <a href=';quicken 2013 software</a>the history of over 50 years. <a href=' http://www.beatsstu..'>beats studio headphones</a>Founded in 1945,<a href=';/a>" target=_blank > http://www.turbotax..</a> recognized worldwide as the leading professional<a href=' http://www.beatswir..'>cheap beats wireless headphones</a> microphone and headphone manufacturer Sennheiser. <a href=' http://www.turbotax..t;turbotax 2012 download</a>Sennheiser continue to lead the trend of new audio technology,<a href=' http://www.beatsbyd..'>cheap beats by dre studio</a> research and development center in Hannover, <a href=';quicken download</a>Germany. It is also the industry-recognized radio, <a href=' http://www.beatsbyd..'>cheap beats by dre solo</a>infrared sound transmission technology, <a href=' http://www.turbotax..scultation headphones,<a href=' http://www.beatsbyd..'>beats by dre tour</a> aviation call headphones, multimedia communication, a pioneer in the call center headsets and headphones.
2013-01-26, 19:03:57
anonymous from China  
2013-02-08, 02:35:37
tombbtqk <a href=' '>payday cash</a> :-O <a href=' '>payday advance</a> %-[[[ <a href=' '>cash advances</a> cgZGkK
2013-02-26, 21:55:29
2013-04-11, 04:25:57
You are on page 1 of 2, other pages: [1] 2



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: