Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to set a  background image into listview?

Posted on 2001-06-11
3
Medium Priority
?
588 Views
Last Modified: 2012-06-27
hi, all
  i want to set a background image into a listview, i've
tried Listview_SetBkImage procedure(i do call CoInitialize before using it),but cant make it work,
would anyone give me a working example? thanx in advance.

 
0
Comment
Question by:receyes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:MarcG
ID: 6180125
Well, I didn't find SetBKImage with a standard ListView, but you can use the method i just tried ... set owner draw to true and add an image component containing the bmp-Image you want to have as background, then use the OnCustomDraw event to draw the image as background

procedure TForm1.ListView1CustomDraw(Sender: TCustomListView;
  const ARect: TRect; var DefaultDraw: Boolean);
var DestRect, SrcRect : TRect;
begin
  DestRect := Rect(0,0,ListView1.width, Listview1.Height);
  SrcRect := Rect(0,0,Image1.Width,Image1.Height);
  ListView1.Canvas.CopyRect(DestRect,image1.picture.Bitmap.Canvas, SrcRect);
end;

If you want to do it dynamically you can use practically the same. the image with the picture should not be set invisible when copying the image but afterwards you can set it invisible.
You should change it a bit if it doesn't fit exactly your needs.
0
 
LVL 8

Accepted Solution

by:
Cesario earned 800 total points
ID: 6181049
a little bit smaller ;-)

procedure TForm1.ListView1CustomDraw(Sender: TCustomListView;
 const ARect: TRect; var DefaultDraw: Boolean);
Begin
 DestRect := Rect(0,0,ListView1.width, Listview1.Height);
 SrcRect := Rect(0,0,Image1.Width,Image1.Height);
 ListView1.Canvas.CopyRect(Listview1.ClientRect.DestRect,image1.picture.Bitmap.Canvas, Image.ClientRect);
end;

Cesairo
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 9285608
receyes,
No comment has been added lately (814 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to Cesario http:#6181049

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

DragonSlayer
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question