Martijn Mulder schreef:
When I zoom in on an image, GDI+ automatically smoothens the edges
between the pixels. I am looking for a way to see the individual pixels
as squares in the enlarged image, like in MSPaint. I searched in vain in
the enumerations System.Drawing.Drawing2D.SmoothingMode and
System.Drawing.Drawing2D.InterpolationMode to find the constant that
does just that. How?
Some code to illustrate the problem:
using System.Drawing;
using System.Windows.Forms;
class MyForm:Form
{
override protected void OnPaint(PaintEventArgs a)
{
Bitmap bitmap=new Bitmap(2,2);
Graphics graphics=Graphics.FromImage(bitmap);
graphics.Clear(Color.Green);
graphics.DrawLine(Pens.Red,1,1,2,2);
graphics.Dispose();
a.Graphics.DrawImage
(
bitmap,
new Rectangle(0,0,200,200),
new Rectangle(0,0,2,2),
GraphicsUnit.Pixel
);
}
[System.STAThread]
static void Main()
{
Application.Run(new MyForm());
}
}