Question Pixel not clear-Urgent

raajakumar

New member
Joined
Oct 17, 2010
Messages
1
Programming Experience
Beginner
i want to create a new bitmap of size 4 x 4 pixels composing of 2 white and 2 black pixel but when i created it's not clear due to overlapping of colors.what's wrong with my approach.thanks in advance


Dim cr As New Bitmap(4, 4)
cr.SetPixel(0, 0, Color.Black)
cr.SetPixel(0, 1, Color.White)
cr.SetPixel(1, 0, Color.White)
cr.SetPixel(1, 1, Color.Black)
Prvwbox.Image = cr
View attachment untitled.bmp
 

Pirelli72

New member
Joined
Oct 27, 2010
Messages
2
Programming Experience
3-5
You set the SizeMode property of PictureBox to .StretchImage and the PictureBoz resize them.
If you save the bitmap in a file you'll see the correct image.

VB.NET:
cr.Save("C:\myFile.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
 
Top Bottom