Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BackgroundImage in ListView
Message
From
01/03/2008 17:55:04
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01297600
Message ID:
01297990
Views:
19
>Only one problem remaining. When I scroll down in my listview the logo does not move.

I was going to suggest using that same code in a Scroll event handler, but that's too obvious. You would have already tried that if the ListView *had* a Scroll event!! And it doesn't. =0(

Maybe you can code up something in the MouseDown event?

~~Bonnie


>>Is there a way to specify where the BackgroundImage image should display in the listview?
>>I want it either centered or in the lower right-hand corner, but it seems that M$ wants it is the upper left-hand corner. It seems the only thing I can do with the BackgroundImage is to set the BackgroundImageTiled property.
>>
>>Thanks,
>>Einar
>
>Here is how I ended up solving my problem. It is not elegant but it works.
>
>Call this code when listview is resized
>
>Bitmap bitmap = new Bitmap(this.listView.Width, this.listView.Height);
>Bitmap logo = new Bitmap(somefilepath);
>
>Graphics graphics = Graphics.FromImage(bitmap);
>graphics.FillRegion(Brushes.White, new Region(new Rectangle(0, 0, bitmap.Width, bitmap.Height)));
>graphics.DrawImage(logo, new Point(bitmap.Width - logo.Width - 25, bitmap.Height - logo.Height - 50));
>graphics.Dispose();
>
>this.listView.BackgroundImage = bitmap;
>
>
>Only one problem remaining. When I scroll down in my listview the logo does not move.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform