我知道将图像绘制到图片框而不会出现锯齿的唯一方法是将图形设置为
uGraphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
uGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
但我能做到这一点的唯一方法就是在PictureBox_Paint事件中做到这一点。
但是,我只想做一次。
有人发现我做错了吗?
我试图这样做:
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
采用这种方法,图像仍然是锯齿状的。 当我使用" Graphics"相反,Paint事件公开,它工作正常,图片是平滑的。
有人可以帮忙吗?