listview and images with different width / height

  • Thread starter Christoph Bergner
  • Start date
C

Christoph Bergner

Hi,

I want to show a number of images in a listview. The
images are different in size and have diffenren
width/height ratio. When I add the image to the listview
it is distorted in size.

My Idea was to create an image (e.g. 80x80 pixel) and
imbed the image into it and then add the image to the
listview. But I dont know how to do it.

Can anybpdy help?

Regrads,
Christpüh
 
J

Joe White

Try something like this:

using (Bitmap bmpLarge = new Bitmap(80, 80))
{
using (Graphics g = Graphics.FromImage(bmpLarge))
{
g.DrawImage(bmpSmall, (bmpLarge.Width - bmpSmall.Width) / 2,
(bmpLarge.Height - bmpSmall.Height) / 2);
}
imageList1.Images.Add(bmpLarge, Color.Transparent);
}


Hi,

I want to show a number of images in a listview. The
images are different in size and have diffenren
width/height ratio. When I add the image to the listview
it is distorted in size.

My Idea was to create an image (e.g. 80x80 pixel) and
imbed the image into it and then add the image to the
listview. But I dont know how to do it.

Can anybpdy help?

Regrads,
Christpüh
 

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