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

Listview control background image by Pooran

Pooran
Fri Dec 12 13:03:22 CST 2003

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: pooran.prasad@itreya.com.REMOVETHIS
Phone(Off) : 5200179/80/81/82/83 Extn: 42
Mobile: +91 98860 29578

>-----Original Message-----
>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
>
>.
>

Re: Listview control background image by hirf-spam-me-here

hirf-spam-me-here
Sat Dec 13 19:56:32 CST 2003

* "m. pollack" <mpollack@firstrain.com> scripsit:
> 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%23DNVHDHA.4048%40tk2msftngp13.phx.gbl>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>