Listview control background image

M

m. pollack

Hi,

I am using a System.Windows.Forms.ListView control and
would like to put an image in the background. Although the
BackgroundImage property is not exposed in the IDE
Properties window for the control, I figured that the
Listview, being descended from the Control class, should
implement the property, so I used the following code in my
form's constructor (after InitializeComponent(), of
course):

listView1.BackgroundImage = Image.FromFile
(@"C:\test2.bmp");

But nothing happens. I also tried this:

listView1.BackgroundImage = new Bitmap(@"C:\test2.bmp");

But the background is still blank. Any ideas?

Thanks, MP
 
P

Pooran Prasad

Hi MP,
Only few controls support this property though there are
many controls that inherit Control class. Unfortunately,
ListView control is one of them. Button, CheckBox, Form
GroupBox, Panel, PictureBox, RadioButton,
TabPage are some controls that support BackgroundImage
Property.
Hope that helps
Have a great day :)
R. Pooran Prasad
Itreya Technologies Pvt Ltd.,
Mail: (e-mail address removed)
Phone(Off) : 5200179/80/81/82/83 Extn: 42
Mobile: +91 98860 29578
 
H

Herfried K. Wagner [MVP]

* "m. pollack said:
I am using a System.Windows.Forms.ListView control and
would like to put an image in the background. Although the
BackgroundImage property is not exposed in the IDE
Properties window for the control, I figured that the
Listview, being descended from the Control class, should
implement the property, so I used the following code in my
form's constructor (after InitializeComponent(), of
course):

The property is not "implemented". You will have to use p/invoke:

<http://groups.google.com/groups?selm=eCS#[email protected]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top