0

Why does SizeMode StretchImage have the following effect and how can I fix it?

gradient Code for example:

Bitmap bitmap = new Bitmap(1,1,PixelFormat.Format24bppRgb);
        bitmap.SetPixel(0,0, Color.Black);
        pictureBox1.Image = bitmap;
Sergey J.
  • 1
  • 2
  • 2
    What do you want it to look like? https://stackoverflow.com/questions/29157/how-do-i-make-a-picturebox-use-nearest-neighbor-resampling? – Ry- Mar 10 '18 at 17:26
  • @Ryan, so that there is no lightening, and the black square remains black – Sergey J. Mar 10 '18 at 17:38
  • That's because graphics get interpolated by default. You can try subclassing PictureBox, override OnPaint, set smoothing and interpolation properties of the Graphics instance stored with the PaintEventArgs to lowest quality and call the base implementation. – Ray Mar 10 '18 at 20:39

0 Answers0