Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BackgroundImage in ListView
Message
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01297600
Message ID:
01297795
Views:
24
>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
Next
Reply
Map
View

Click here to load this message in the networking platform