Re: How to show individual pixels? (Was: Show Me The Pixel)
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Mon, 17 Sep 2007 12:21:39 -0500
"Martijn Mulder" <i@m> wrote in message
news:46ee96c2$0$85112$dbd4f001@xxxxxxxxxxxxxxxxxx
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?
I would think that NearestNeighbor would be the one that matches the old
StretchBlt functionality.
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());
}
}
.
- Follow-Ups:
- Re: How to show individual pixels? (Was: Show Me The Pixel)
- From: Martijn Mulder
- Re: How to show individual pixels? (Was: Show Me The Pixel)
- References:
- How to show individual pixels? (Was: Show Me The Pixel)
- From: Martijn Mulder
- How to show individual pixels? (Was: Show Me The Pixel)
- Prev by Date: Re: Problems Handling Errors Correctly
- Next by Date: Re: Regex
- Previous by thread: Re: How to show individual pixels? (Was: Show Me The Pixel)
- Next by thread: Re: How to show individual pixels? (Was: Show Me The Pixel)
- Index(es):
Relevant Pages
|