Picture in list only displays half

Im using this code to grab a picture file and display it in a listbox. The listbox cell size is 104 x 100. Whenever I scale the image with this code and put it into the listbox, only half the picture displays. the left side of the picture is cut off and about middle way through the picture is what is starting at the 0,0 point. What am I doing wrong?

If f <> Nil And f.Exists Then
  Dim pOriginalPicture As Picture = Picture.Open(f)
  Dim pScaledPicture As New Picture(104, 100)
  
  pScaledPicture.Graphics.DrawPicture(pOriginalPicture, 0, 0, 104, 100, 0, 0, pOriginalPicture.Width, pOriginalPicture.Height)
  
  ListBox_Images.RowImageAt(0) = Nil
  ListBox_Images.RowImageAt(0) = pScaledPicture
End If

I remember this being a thing from long ago, but I can’t find a feedback case for it. I do remember it being why I always store pictures using CellTagAt and draw them myself in PaintCellBackground or PaintCellText. If there’s some property controlling this behavior, I don’t know what it is and just stuck to my workaround over the years because it gives me more control over how the image is displayed.

2 Likes