Forum > General

Some tip for putting a image background in a ListView?

(1/1)

alejol0:
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!

typo:

--- Code: ---ListView1.Canvas.StretchDraw(ListView1.ClientRect, Image1.Picture.Bitmap);
--- End code ---

alejol0:
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: ---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;


--- End code ---

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

Navigation

[0] Message Index

Go to full version