0

The only way I know to draw an image to a picturebox without being jagged, is settings the Graphics to

    uGraphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
    uGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

But the only way where I can do this is to do that inside a PictureBox_Paint event.

However, I would like to do it only once.

Does anybody spot where I did it wrong?

I was trying to do it like this:

PictureBoxSetImage(Me.picUserImage, Me.ILUserIcons.Images(sGUID))

Public Sub PictureBoxSetImage(ByRef uPic As PictureBox, ByRef uBMP As Bitmap)

    Using g As Graphics = Graphics.FromImage(uBMP)
        modControls.GraphicsSetSmoothingMode(g)
        uPic.Image = uBMP
    End Using

End Sub

Public Sub GraphicsSetSmoothingMode(ByRef uGraphics As Graphics)

    uGraphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
    uGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

End Sub

With this approach, the image is still jagged. When I use the "Graphics" instead that the Paint event exposes, it works fine, and the picture is smoothed.

Can anyone help?

tmighty
  • 10,734
  • 21
  • 104
  • 218

0 Answers0