Files
ImageCompressor/MainForm/NewPictureBox.cs
2026-02-02 21:56:45 +08:00

24 lines
737 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading.Tasks;
namespace ImageCompressor
{
internal class NewPictureBox:PictureBox
{
/// <summary>
/// 以不抗锯齿方式绘制原图像素
/// </summary>
/// <param name="pe"></param>
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);
}
}
}