title: winforms graphics with nearest neighbor filtering clipping edges of image
body: <p>I'm writing a Chip8 emulator/interpreter.  It's going great.  To the point I need a UI to play some games and watch this bad Jackson in motion.  I first ran into a problem where drawing the framebuffer (which is just a bitmap) to the screen was super-blurry.  After figuring out I needed to set the interpolation mode to Nearest Neighbor it looked much better, but it seems the edges of the image are either being clipped or I'm misunderstanding the interpolation at work.  Here's a screenshot.</p>
  
  <p><img src="https://i.stack.imgur.com/K2HjY.png" alt="A screenshot of the issue.  Note the edges."></p>
  
  <p>The edges you see around the top, left, and right should end with "whole" white pixels keeping with the pattern you see.  Especially easy to see the issue at the top left, should be one whole white pixel.</p>
  
  <p>The image being upscaled is 64x32, and is being drawn using a normal graphics object, as such: (ignore the 64 * 6, I know it's funny)</p>
  
  <pre><code>g.DrawImage (cpu.raster, 0, 0, 64 * 6, 32 * 6);
  </code></pre>
  
  <p>Where "cpu.raster" is the bitmap the emulator renders the game to.  I'd post the rest of the code, but it all seems pretty standard.  The only other code that even relates to the graphics is the interpolation/smoothing modes, which are set as such:</p>
  
  <pre><code>        g = this.CreateGraphics ();
          g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
          g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
          this.DoubleBuffered = true;
  </code></pre>
  
  <p>Is there another setting I should be aware of to prevent this?  I tried reducing the size of the drawn image, thinking maybe the form was clipping it somehow, but it's not, the image ends at the edges you see in the screenshot.</p>