using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using System.Threading.Tasks; namespace ImageCompressor { internal class NewPictureBox:PictureBox { /// /// 以不抗锯齿方式绘制原图像素 /// /// protected override void OnPaint(PaintEventArgs pe) { pe.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; pe.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; pe.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half; base.OnPaint(pe); } } }