Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BackgroundImage in ListView
Message
 
To
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:
01298150
Views:
18
I don't think it is too hard to trap when the scrollbar is activated (but I haven't started looking at it yet). I might start looking into doing the drawing in OnPaint instead because it will be a lot more efficient. Creating a big image on the fly only to use a small portion of the lower right hand corner is not very good managing of my resources :)
I just can't believe it is not built into the listview control.

>>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.
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform