Recent

Author Topic: Some tip for putting a image background in a ListView?  (Read 3972 times)

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
Some tip for putting a image background in a ListView?
« on: August 17, 2010, 09:21:18 pm »
Hi!
Any one knows how to put a image as a background of a ListView?

I try to mimic the Windows desktop for WineXO.

Thanks!
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Some tip for putting a image background in a ListView?
« Reply #1 on: August 17, 2010, 09:32:25 pm »
Code: [Select]
ListView1.Canvas.StretchDraw(ListView1.ClientRect, Image1.Picture.Bitmap);

alejol0

  • Jr. Member
  • **
  • Posts: 60
  • Electronic technician
    • My Facebook page
Re: Some tip for putting a image background in a ListView?
« Reply #2 on: August 18, 2010, 11:32:17 pm »
Thanks typo! Your code works.

I assign a picture to an Image control (Image1).
I put this code inside the OnPaint event of Form1 and works:

Code: [Select]
procedure TForm1.FormPaint(Sender: TObject);
var
  i: Integer;
begin
   ListView1.Canvas.Draw(0,0, Image1.Picture.Bitmap);
   //ListView1.Canvas.Draw(ListView1.ClientRect, Image1.Picture.Bitmap);
  If ListView1.Items.Count <1 then exit;
  For i:=0 to ListView1.Items.Count -1 do
  begin
   //I make this kludge because is needed to show the icons
    ListView1.Items.Item[i].Selected:=True;
    ListView1.Items.Item[i].Selected:=False;
  end;

end;


This is very close to what I want. But...
How to make the icons with transparent regions?
Because the icons are showed inside a opaque rectangle.

-- alejandro.lavarello (at) gmail (dot) com
Contact me: lavarello1966 (at) gmail . com
or
alejandro.lavarello (at) gmail (dot) com

 

TinyPortal © 2005-2018