How to draw smooth images with C#?

前端 未结 2 1202
我寻月下人不归
我寻月下人不归 2020-12-06 03:02

I\'m trying to draw images on a C# form (in PictureBoxes, as well as using Graphics.DrawImage()), and am looking for a way to draw them smooth. The images

2条回答
  •  一生所求
    2020-12-06 03:32

    When drawing the image to a canvas, you can change the interpolation mode to something nicer then nearest neighbor to make resized images smooth:

    Graphics g = ...
    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
    g.DrawImage(...);
    

    You'll need to add System.Drawing.Drawing2D to get the InterpolationMode enum.

    Using PictureBox will be a problem - it doesn't expose an InterpolationMode property, so you'll need to roll your own or download one.

提交回复
热议问题