Jar*_*ike 24 .net c# gdi+ picturebox winforms
我正在使用StretchImage,因为该框可以使用分割器调整大小.看起来默认是某种平滑的双线性滤波,导致我的图像模糊并具有莫尔条纹.
JYe*_*ton 31
我也需要这个功能.我创建了一个继承PictureBox的类,覆盖OnPaint并添加一个属性以允许设置插值模式:
using System.Drawing.Drawing2D;
using System.Windows.Forms;
/// <summary>
/// Inherits from PictureBox; adds Interpolation Mode Setting
/// </summary>
public class PictureBoxWithInterpolationMode : PictureBox
{
public InterpolationMode InterpolationMode { get; set; }
protected override void OnPaint(PaintEventArgs paintEventArgs)
{
paintEventArgs.Graphics.InterpolationMode = InterpolationMode;
base.OnPaint(paintEventArgs);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10437 次 |
| 最近记录: |