listview and images with different width / height

  • Thread starter Thread starter Christoph Bergner
  • Start date 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
 
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
 
Back
Top