0

I am trying to paint an image from an imagelist to a picturebox on demand, not in the OnPaint event.

I am using

 Me.picUserImage.Image = Me.ILUserIcons.Images(sGUID)

This works fine, but the image looks jagged.

Usually (when I am using OnPaint) I use the following code:

    e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
    e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
    e.Graphics.DrawImage(Me.ilUsers.Images(iImageIndex), nRect)

This works fine. But I am unable to set this smoothing mode in my on-demand sub.

Can someone tell me what I am doing wrong?

tmighty
  • 10,734
  • 21
  • 104
  • 218
  • Are you resizing that image with the nRect? Screen shot would help, the before and after. – LarsTech Apr 22 '14 at 17:46
  • possible duplicate of [How to draw smooth images with C#?](http://stackoverflow.com/questions/566245/how-to-draw-smooth-images-with-c) – jlew Apr 22 '14 at 17:48
  • But your audience doesn't know that. Try `nRect.Location` instead of just `nRect`. – LarsTech Apr 22 '14 at 17:57
  • An ImageList is not an appropriate image collection object. Not setting its ImageSize and ColorDepth properties to sufficiently large values is the next standard mistake. Use a List(Of Image) instead. – Hans Passant Apr 22 '14 at 18:01

0 Answers0